Table of Contents

TFlxNumberFormat.FormatValue Method

Overloads

TFlxNumberFormat.FormatValue(Object, String, ExcelFile)

Formats a value as it would be shown by Excel.

Syntax

Namespace: FlexCel.Core

public static String FormatValue(Object Value, String Format, ExcelFile Workbook)

Parameters

<-> Parameter Type Description
Value Object Value to format.
Format String Cell Format. (For example, "yyyy-mm-dd" for a date format, or "#.00" for a numeric 2 decimal format)
This format string is the same you use in Excel under "Custom" format when formatting a cell (for English versions of Excel), and it is documented in the Excel documentation. You can use APIMate to find out which string to use from a format you entered in Excel.
Workbook ExcelFile Workbook with the cell. If null, no color information will be returned and the base date fill be assumed to be 1900 (windows) and not 1904 (macs).

See also

TFlxNumberFormat.FormatValue(Object, String, TUIColor, ExcelFile)

Formats a value as it would be shown by Excel. Conditional formats are not applied, you need to call ExcelFile.ConditionallyModifyFormat(TFlxFormat, Int32, Int32, Boolean, TDrawingConditionalFormat) to the cell style for that.

Syntax

Namespace: FlexCel.Core

public static TRichString FormatValue(Object Value, String Format, ref TUIColor aColor, ExcelFile Workbook)

Parameters

<-> Parameter Type Description
Value Object Value to format.
Format String Cell Format. (For example, "yyyy-mm-dd" for a date format, or "#.00" for a numeric 2 decimal format)
This format string is the same you use in Excel under "Custom" format when formatting a cell (for English versions of Excel), and it is documented in the Excel documentation. You can use APIMate to find out which string to use from a format you entered in Excel.
ref aColor TUIColor Final color of the text. (Depending on the format, color might change. I.e. Red for negatives)
Workbook ExcelFile Workbook with the cell. If null, no color information will be returned and the base date fill be assumed to be 1900 (windows) and not 1904 (macs).

Returns

Formatted string.

See also

TFlxNumberFormat.FormatValue(Object, String, TUIColor, ExcelFile, Boolean)

Formats a value as it would be shown by Excel. Conditional formats are not applied, you need to call ExcelFile.ConditionallyModifyFormat(TFlxFormat, Int32, Int32, Boolean, TDrawingConditionalFormat) to the cell style for that.

Syntax

Namespace: FlexCel.Core

public static TRichString FormatValue(Object Value, String Format, ref TUIColor aColor, ExcelFile Workbook, Boolean ignorePrintErrors)

Parameters

<-> Parameter Type Description
Value Object Value to format.
Format String Cell Format. (For example, "yyyy-mm-dd" for a date format, or "#.00" for a numeric 2 decimal format)
This format string is the same you use in Excel under "Custom" format when formatting a cell (for English versions of Excel), and it is documented in the Excel documentation. You can use APIMate to find out which string to use from a format you entered in Excel.
ref aColor TUIColor Final color of the text. (Depending on the format, color might change. I.e. Red for negatives)
Workbook ExcelFile Workbook with the cell. If null, no color information will be returned and the base date fill be assumed to be 1900 (windows) and not 1904 (macs).
ignorePrintErrors Boolean If true, the string for an error like #DIV/0 will always by #DIV/0 instead of using the value of ExcelFile.PrintErrors. Set it to true when the value is not for printing it.

Returns

Formatted string.

See also

TFlxNumberFormat.FormatValue(Object, String, TUIColor, ExcelFile, Boolean, Boolean)

Formats a value as it would be shown by Excel.

Syntax

Namespace: FlexCel.Core

public static TRichString FormatValue(Object Value, String Format, ref TUIColor aColor, ExcelFile Workbook, out Boolean HasDate, out Boolean HasTime)

Parameters

<-> Parameter Type Description
Value Object Value to format.
Format String Cell Format. (For example, "yyyy-mm-dd" for a date format, or "#.00" for a numeric 2 decimal format)
This format string is the same you use in Excel under "Custom" format when formatting a cell (for English versions of Excel), and it is documented in the Excel documentation. You can use APIMate to find out which string to use from a format you entered in Excel.
ref aColor TUIColor Final color of the text. (Depending on the format, color might change. I.e. Red for negatives)
Workbook ExcelFile Workbook with the cell. If null, no color information will be returned and the base date fill be assumed to be 1900 (windows) and not 1904 (macs).
out HasDate Boolean Returns if the format contains a date.
out HasTime Boolean Returns if the format contains a time.

Returns

Formatted string.

See also

TFlxNumberFormat.FormatValue(Object, String, TUIColor, ExcelFile, Boolean, Boolean, TAdaptativeFormats)

Formats a value as it would be shown by Excel.

Syntax

Namespace: FlexCel.Core

public static TRichString FormatValue(Object Value, String Format, ref TUIColor aColor, ExcelFile Workbook, out Boolean HasDate, out Boolean HasTime, out TAdaptativeFormats AdaptativeFormats)

Parameters

<-> Parameter Type Description
Value Object Value to format.
Format String Cell Format. (For example, "yyyy-mm-dd" for a date format, or "#.00" for a numeric 2 decimal format)
This format string is the same you use in Excel under "Custom" format when formatting a cell (for English versions of Excel), and it is documented in the Excel documentation. You can use APIMate to find out which string to use from a format you entered in Excel.
ref aColor TUIColor Final color of the text. (Depending on the format, color might change. I.e. Red for negatives)
Workbook ExcelFile Workbook with the cell. If null, no color information will be returned and the base date fill be assumed to be 1900 (windows) and not 1904 (macs).
out HasDate Boolean Returns if the format contains a date.
out HasTime Boolean Returns if the format contains a time.
out AdaptativeFormats TAdaptativeFormats Returns micro-justification information needed to adapt the text better to a cell. Null if there are no adaptative formats.

Returns

Formatted string.

See also

TFlxNumberFormat.FormatValue(Object, String, TUIColor, ExcelFile, Boolean, Boolean, Int32, TAdaptativeFormats)

Formats a value as it would be shown by Excel.

Syntax

Namespace: FlexCel.Core

public static TRichString FormatValue(Object Value, String Format, ref TUIColor aColor, ExcelFile Workbook, out Boolean HasDate, out Boolean HasTime, out Int32 PercentCount, out TAdaptativeFormats AdaptativeFormats)

Parameters

<-> Parameter Type Description
Value Object Value to format.
Format String Cell Format. (For example, "yyyy-mm-dd" for a date format, or "#.00" for a numeric 2 decimal format)
This format string is the same you use in Excel under "Custom" format when formatting a cell (for English versions of Excel), and it is documented in the Excel documentation. You can use APIMate to find out which string to use from a format you entered in Excel.
ref aColor TUIColor Final color of the text. (Depending on the format, color might change. I.e. Red for negatives)
Workbook ExcelFile Workbook with the cell. If null, no color information will be returned and the base date fill be assumed to be 1900 (windows) and not 1904 (macs).
out HasDate Boolean Returns if the format contains a date.
out HasTime Boolean Returns if the format contains a time.
out PercentCount Int32 Returns the number of % signs applied to the format. Each % in the format string multiplies the number by 100, so 0.1 displays as "10%" or "1000%%"
out AdaptativeFormats TAdaptativeFormats Returns micro-justification information needed to adapt the text better to a cell. Null if there are no adaptative formats.

Returns

Formatted string.

See also