Aspose::Words::Fields::FieldOptions::get_LegacyNumberFormat method
Contents
[
Hide
]FieldOptions::get_LegacyNumberFormat method
Gets or sets the value indicating whether legacy (early than AW 13.10) number format for fields is enabled or not.
_Bool Aspose::Words::Fields::FieldOptions::get_LegacyNumberFormat() const
Remarks
When this property is set to true, template symbol “#” worked as in .net: Replaces the pound sign with the corresponding digit if one is present; otherwise, no symbols appears in the result string.
When this property is set to false, template symbol “#” works as MS Word: This format item specifies the requisite numeric places to display in the result. If the result does not include a digit in that place, MS Word displays a space. For example, { = 9 + 6 # $### } displays $ 15.
The default value is false.
Examples
Shows how enable legacy number formatting for fields.
auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
System::SharedPtr<Aspose::Words::Fields::Field> field = builder->InsertField(u"= 2 + 3 \\# $##");
ASSERT_EQ(field->get_Result(), u"$ 5");
doc->get_FieldOptions()->set_LegacyNumberFormat(true);
field->Update();
ASSERT_EQ(field->get_Result(), u"$5");
See Also
- Class FieldOptions
- Namespace Aspose::Words::Fields
- Library Aspose.Words for C++