Class
CellContentSizeHelper

Utility for estimating rendered cell content size based on formatting so you can choose column widths that fit values without truncation.

Definition

Namespace:Telerik.Documents.SpreadsheetStreaming

Assembly:Telerik.Documents.SpreadsheetStreaming.dll

Syntax:

cs-api-definition
public static class CellContentSizeHelper

Inheritance: objectCellContentSizeHelper

Methods

GetCellContentSize(string, SpreadCellFormat, double)

Calculates the rendered size of cell content using its formatting so you can derive an appropriate column width for the value.

Declaration

cs-api-definition
public static Size GetCellContentSize(string value, SpreadCellFormat spreadCellFormat, double cellWidth = 65)

Parameters

value

string

The cell value. If formula is passed the method will throw an ArgumentException.

spreadCellFormat

SpreadCellFormat

The format of the cell.

cellWidth

double

The width of the cell in pixels. This value is only respected if the value of the WrapText property of the spreadCellFormat is true. The default column width is 65 pixels.

Returns

Size

The size of the cell content.

GetCellContentSize(string, string, string, double, bool, bool, SpreadHorizontalAlignment, bool, int, double)

Calculates the rendered size of cell content using explicit formatting parameters, enabling custom sizing logic outside a worksheet.

Declaration

cs-api-definition
public static Size GetCellContentSize(string value, string cellValueFormat, string fontFamily, double fontSize, bool isBold, bool isItalic, SpreadHorizontalAlignment horizontalAlignment, bool isWrapped, int indent, double cellWidth = 65)

Parameters

value

string

The cell value. If formula is passed the method will throw an ArgumentException.

cellValueFormat

string

The number format of the cell.

fontFamily

string

The font family.

fontSize

double

The size of the font in points.

isBold

bool

A value indicating whether the text is bold.

isItalic

bool

A value indicating whether the text is italic.

horizontalAlignment

SpreadHorizontalAlignment

The horizontal alignment.

isWrapped

bool

A value indicating whether the text is wrapped.

indent

int

The cell indent.

cellWidth

double

The width of the cell in pixels. This value is only respected if the value of isWrapped is true. The default column width is 65 pixels.

Returns

Size

The size of the cell content.