DisplayTextFormatterSupport

DisplayTextFormatterSupport

Overview

DisplayTextFormatterSupport is a class in Aspose.Cells FOSS for C++.

Internal helper methods for display-text formatting of numeric, text, and date/time values.

Methods

SignatureDescription
SelectNumericSection(sections: std::vector<DisplayFormatSectionInfo>, numericValue: double, useAbsoluteValue: bool)std::optional<DisplayFormatSectionInfo>Selects the appropriate numeric section from a parsed format code. Returns std::nullopt when sections is empty.
SelectTextSection(sections: std::vector<DisplayFormatSectionInfo>)std::optional<DisplayFormatSectionInfo>Selects the text section (fourth section, or first containing ‘@’). Returns std::nullopt if no text section is found.
SelectDateTimeSection(sections: std::vector<DisplayFormatSectionInfo>)std::optional<DisplayFormatSectionInfo>Selects the first non-empty date/time section (among the first three). Returns std::nullopt if all are blank.
ParseSections(formatCode: std::string_view)std::vector<DisplayFormatSectionInfo>Parses a format code into section descriptors.
SplitSections(formatCode: std::string_view)std::vector<std::string>Splits a format code on unquoted, unescaped semicolons.
TryParseSectionCondition(section: std::string_view, conditionOperator: std::string, conditionValue: double)boolAttempts to parse a condition (operator + value) from a section string.
TryParseConditionToken(token: std::string_view, conditionOperator: std::string, conditionValue: double)boolAttempts to parse a condition token such as “>=10”.
EvaluateCondition(conditionOperator: std::string_view, numericValue: double, conditionValue: double)boolEvaluates a comparison between numericValue and conditionValue.
ShouldUseAbsoluteValue(section: std::string_view, numericValue: double)boolDetermines whether the absolute value of a negative number should be used when formatting (i.e. the pattern has no explicit ‘-’ sign).
SanitizeNumericSection(section: std::string_view)std::stringStrips directive brackets, quote escapes, and placeholder characters from a numeric section, returning the cleaned string (edge-trimmed).
StripDirectiveBrackets(section: std::string_view, preserveElapsedTokens: bool)std::stringRemoves bracketed directive tokens from a section string.
ContainsNumericPlaceholder(pattern: std::string_view)boolReturns true if the pattern contains any numeric placeholder character.
ExpandSectionPattern(pattern: std::string_view, valueText: std::string_view, replaceTextPlaceholder: bool)std::stringExpands a section pattern by replacing text placeholders and removing formatting escapes.
IsNumericValue(value: CellValue)boolReturns true if the CellValue holds a numeric type (int or double).
ConvertToDouble(value: CellValue)doubleConverts a numeric CellValue to double. Throws std::invalid_argument if the value is not numeric.
GetAbsoluteNumericValue(value: CellValue)CellValueReturns the absolute numeric value. Non-numeric values are returned unchanged.

See Also