Class CellContentSizeHelper
Utility for estimating rendered cell content size based on formatting so you can choose column widths that fit values without truncation.
Inheritance
Inherited Members
Namespace: Telerik.Documents.SpreadsheetStreaming
Assembly: Telerik.Documents.SpreadsheetStreaming.dll
Syntax
public static class CellContentSizeHelper
Methods
GetCellContentSize(String, String, String, Double, Boolean, Boolean, SpreadHorizontalAlignment, Boolean, Int32, Double)
Calculates the rendered size of cell content using explicit formatting parameters, enabling custom sizing logic outside a worksheet.
Declaration
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
|
System.String
value
The cell value. If formula is passed the method will throw an ArgumentException. |
|
System.String
cellValueFormat
The number format of the cell. |
|
System.String
fontFamily
The font family. |
|
System.Double
fontSize
The size of the font in points. |
|
System.Boolean
isBold
A value indicating whether the text is bold. |
|
System.Boolean
isItalic
A value indicating whether the text is italic. |
|
SpreadHorizontalAlignment
horizontalAlignment
The horizontal alignment. |
|
System.Boolean
isWrapped
A value indicating whether the text is wrapped. |
|
System.Int32
indent
The cell indent. |
|
System.Double
cellWidth
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
|
System.Windows.Size
The size of the cell content. |
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
public static Size GetCellContentSize(string value, SpreadCellFormat spreadCellFormat, double cellWidth = 65)
Parameters
|
System.String
value
The cell value. If formula is passed the method will throw an ArgumentException. |
|
SpreadCellFormat
spreadCellFormat
The format of the cell. |
|
System.Double
cellWidth
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
|
System.Windows.Size
The size of the cell content. |