DisplayTextFormatterSupport

DisplayTextFormatterSupport

概述

DisplayTextFormatterSupport 是 Aspose.Cells FOSS for C++ 中的一个类。

用于数值、文本和日期/时间值的显示文本格式化的内部辅助方法。

此类在 C++ 程序中提供了 17 个用于处理 DisplayTextFormatterSupport 对象的方法。可用的方法包括:ContainsNumericPlaceholder、ConvertToDouble、DisplayTextFormatterSupport、EvaluateCondition、ExpandSectionPattern、GetAbsoluteNumericValue、IsNumericValue、ParseSections、SanitizeNumericSection、SelectDateTimeSection、SelectNumericSection、SelectTextSection,以及另外 5 个方法。安装 Aspose.Cells FOSS for C++ 包后,所有公共成员均可供任何 C++ 应用程序访问。

方法

签名描述
DisplayTextFormatterSupport()在此 DisplayTextFormatterSupport 实例上调用 DisplayTextFormatterSupport。
SelectNumericSection(sections: std::vector<DisplayFormatSectionInfo>, numericValue: double, useAbsoluteValue: bool) → std::optional<DisplayFormatSectionInfo>从解析后的格式代码中选择合适的数字段。若 sections 为空,则返回 std::nullopt。
SelectTextSection(sections: std::vector<DisplayFormatSectionInfo>) → std::optional<DisplayFormatSectionInfo>选择文本段(第四段,或第一个包含 ‘@’ 的段)。如果未找到文本段,则返回 std::nullopt。
SelectDateTimeSection(sections: std::vector<DisplayFormatSectionInfo>) → std::optional<DisplayFormatSectionInfo>在前三级中选择第一个非空的日期/时间段。若全部为空,则返回 std::nullopt。
ParseSections(formatCode: std::string_view) → std::vector<DisplayFormatSectionInfo>将格式代码解析为段描述符。
SplitSections(formatCode: std::string_view) → std::vector<std::string>在未加引号且未转义的分号处拆分格式代码。
TryParseSectionCondition(section: std::string_view, conditionOperator: std::string, conditionValue: double) → bool尝试从节字符串中解析条件(运算符 + 值)。
TryParseConditionToken(token: std::string_view, conditionOperator: std::string, conditionValue: double) → bool尝试解析诸如 “>=10” 的条件标记。
EvaluateCondition(conditionOperator: std::string_view, numericValue: double, conditionValue: double) → bool对 numericValue 和 conditionValue 之间的比较进行求值。
ShouldUseAbsoluteValue(section: std::string_view, numericValue: double) → bool确定在格式化时是否应使用负数的绝对值(即模式中没有显式的 ‘-’ 符号)。
SanitizeNumericSection(section: std::string_view) → std::string从数值段中去除指令括号、引号转义和占位符字符,返回已清理的字符串(已进行边缘裁剪)。
StripDirectiveBrackets(section: std::string_view, preserveElapsedTokens: bool) → std::string从段落字符串中移除带括号的指令标记。
ContainsNumericPlaceholder(pattern: std::string_view) → bool如果模式包含任何数字占位符字符,则返回 true。
ExpandSectionPattern(pattern: std::string_view, valueText: std::string_view, replaceTextPlaceholder: bool) → std::string通过替换文本占位符并移除格式转义,展开 section pattern。
IsNumericValue(value: CellValue) → bool如果 CellValue 持有数值类型(int 或 double),则返回 true。
ConvertToDouble(value: CellValue) → double将数值 CellValue 转换为 double。如果该值不是数值,则抛出 std::invalid_argument。
GetAbsoluteNumericValue(value: CellValue) → CellValue返回绝对数值。非数值的值保持不变返回。

另请参阅

 中文