Aspose::Words::Fields::GeneralFormat enum

GeneralFormat enum

Specifies a general format that is applied to a numeric, text, or any field result. A field may have a combination of general formats.

enum class GeneralFormat : int

Values

NameValueDescription
Aiueo1Numeric formatting. Formats a numeric result using hiragana characters in the traditional a-i-u-e-o order.
Arabic4Numeric formatting. Formats a numeric result using Arabic cardinal numerals.
ArabicAbjad5Numeric formatting. Formats a numeric result using ascending Abjad numerals.
ArabicAlpha6Numeric formatting. Formats a numeric result using characters in the Arabic alphabet.
ArabicDash7Numeric formatting. Formats a numeric result using Arabic cardinal numerals, with a prefix of “- " and a suffix of " -”.
BahtText8Numeric formatting. Formats a numeric result in the Thai counting system.
Caps49Text formatting. Capitalizes the first letter of each word.
CardText9Numeric formatting. Cardinal text (One, Two, Three, …).
CharFormat53Field result formatting. The CHARFORMAT instruction.
ChineseNum110Numeric formatting. Formats a numeric result using ascending numbers from the appropriate counting system.
ChineseNum211Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal format.
ChineseNum312Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting thousand system.
Chosung13Numeric formatting. Formats a numeric result using sequential numbers from the Korean Chosung format.
CircleNum14Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character for numbers in the range 1–20.
DBChar15Numeric formatting. Formats a numeric result using double-byte Arabic numbering.
DBNum116Numeric formatting. Formats a numeric result using sequential digital ideographs, using the appropriate character.
DBNum217Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting system.
DBNum318Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal counting system.
DBNum419Numeric formatting. Formats a numeric result using sequential numbers from the appropriate digital counting system.
DollarText20Numeric formatting. Dollar text (One, Two, Three, … + AND 55/100).
FirstCap50Text formatting. Capitalizes the first letter of the first word.
GB122Numeric formatting. Formats a numeric result using decimal numbering followed by a period, using the enclosed alphanumeric glyph character.
GB223Numeric formatting. Formats a numeric result using decimal numbering enclosed in parenthesis, using the enclosed alphanumeric glyph character.
GB324Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
GB425Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
Ganada21Numeric formatting. Formats a numeric result using sequential numbers from the Korean Ganada format.
Hebrew126Numeric formatting. Formats a numeric result using Hebrew numerals.
Hebrew227Numeric formatting. Formats a numeric result using the Hebrew alphabet.
Hex28Numeric formatting. Formats the numeric result using uppercase hexadecimal digits.
HindiArabic29Numeric formatting. Formats a numeric result using Hindi numbers.
HindiCardText30Numeric formatting. Formats a numeric result using sequential numbers from the Hindi counting system.
HindiLetter131Numeric formatting. Formats a numeric result using Hindi vowels.
HindiLetter232Numeric formatting. Formats a numeric result using Hindi consonants.
Iroha33Numeric formatting. Formats a numeric result using the Japanese iroha.
KanjiNum134Numeric formatting. Formats a numeric result using a Japanese style using the appropriate counting system.
KanjiNum235Numeric formatting. Formats a numeric result using the appropriate counting system.
KanjiNum336Numeric formatting. Formats a numeric result using the appropriate counting system.
Lower51Text formatting. All letters are lowercase.
LowercaseAlphabetic3Numeric formatting. Formats a numeric result as one or more occurrences of an lowercase alphabetic Latin character.
LowercaseRoman40Numeric formatting. Lowercase Roman (i, ii, iii, …).
MergeFormat54Field result formatting. The MERGEFORMAT instruction.
MergeFormatInet55Field result formatting. The MERGEFORMATINET instruction.
None0Used to specify a missing general format.
OrdText38Numeric formatting. Ordinal text (First, Second, Third, …).
Ordinal37Numeric formatting. Ordinal (1st, 2nd, 3rd, …).
SBChar41Numeric formatting. Formats a numeric result using single-byte Arabic numbering.
ThaiArabic42Numeric formatting. Formats a numeric result using Thai numbers.
ThaiCardText43Numeric formatting. Formats a numeric result using sequential numbers from the Thai counting system.
ThaiLetter44Numeric formatting. Formats a numeric result using Thai letters.
Upper52Text formatting. All letters are uppercase.
UppercaseAlphabetic2Numeric formatting. Formats a numeric result as one or more occurrences of an uppercase alphabetic Latin character.
UppercaseRoman39Numeric formatting. Uppercase Roman (I, II, III, …).
VietCardText45Numeric formatting. Formats a numeric result using Vietnamese numerals.
Zodiac146Numeric formatting. Formats a numeric result using sequential numerical traditional ideographs.
Zodiac247Numeric formatting. Formats a numeric result using sequential zodiac ideographs.
Zodiac348Numeric formatting. Formats a numeric result using sequential traditional zodiac ideographs.

Examples

Shows how to format field results.

auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);

// Use a document builder to insert a field that displays a result with no format applied.
System::SharedPtr<Aspose::Words::Fields::Field> field = builder->InsertField(u"= 2 + 3");

ASSERT_EQ(field->GetFieldCode(), u"= 2 + 3");
ASSERT_EQ(field->get_Result(), u"5");

// We can apply a format to a field's result using the field's properties.
// Below are three types of formats that we can apply to a field's result.
// 1 -  Numeric format:
System::SharedPtr<Aspose::Words::Fields::FieldFormat> format = field->get_Format();
format->set_NumericFormat(u"$###.00");
field->Update();

ASSERT_EQ(field->GetFieldCode(), u"= 2 + 3 \\# $###.00");
ASSERT_EQ(field->get_Result(), u"$  5.00");

// 2 -  Date/time format:
field = builder->InsertField(u"DATE");
format = field->get_Format();
format->set_DateTimeFormat(u"dddd, MMMM dd, yyyy");
field->Update();

ASSERT_EQ(field->GetFieldCode(), (u"DATE \\@ \"dddd, MMMM dd, yyyy\""));
std::cout << System::String::Format(u"Today's date, in {0} format:\n\t{1}", format->get_DateTimeFormat(), field->get_Result()) << std::endl;

// 3 -  General format:
field = builder->InsertField(u"= 25 + 33");
format = field->get_Format();
format->get_GeneralFormats()->Add(GeneralFormat::LowercaseRoman);
format->get_GeneralFormats()->Add(GeneralFormat::Upper);
field->Update();

int32_t index = 0;
{
    System::SharedPtr<System::Collections::Generic::IEnumerator<Aspose::Words::Fields::GeneralFormat>> generalFormatEnumerator = format->get_GeneralFormats()->GetEnumerator();
    while (generalFormatEnumerator->MoveNext())
    {
        std::cout << System::String::Format(u"General format index {0}: {1}", index++, generalFormatEnumerator->get_Current()) << std::endl;
    }
}

ASSERT_EQ(field->GetFieldCode(), u"= 25 + 33 \\* roman \\* Upper");
ASSERT_EQ(field->get_Result(), u"LVIII");
ASSERT_EQ(format->get_GeneralFormats()->get_Count(), 2);
ASSERT_EQ(format->get_GeneralFormats()->idx_get(0), GeneralFormat::LowercaseRoman);

// We can remove our formats to revert the field's result to its original form.
format->get_GeneralFormats()->Remove(GeneralFormat::LowercaseRoman);
format->get_GeneralFormats()->RemoveAt(0);
ASSERT_EQ(format->get_GeneralFormats()->get_Count(), 0);
field->Update();

ASSERT_EQ(field->GetFieldCode(), u"= 25 + 33  ");
ASSERT_EQ(field->get_Result(), u"58");
ASSERT_EQ(format->get_GeneralFormats()->get_Count(), 0);

See Also