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

Values

NameValueDescription
None0Used to specify a missing general format.
Aiueo1Numeric formatting. Formats a numeric result using hiragana characters in the traditional a-i-u-e-o order.
UppercaseAlphabetic2Numeric formatting. Formats a numeric result as one or more occurrences of an uppercase alphabetic Latin character.
LowercaseAlphabetic3Numeric formatting. Formats a numeric result as one or more occurrences of an lowercase alphabetic Latin character.
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.
CardText9Numeric formatting. Cardinal text (One, Two, Three, …).
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).
Ganada21Numeric formatting. Formats a numeric result using sequential numbers from the Korean Ganada format.
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.
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.
Ordinal37Numeric formatting. Ordinal (1st, 2nd, 3rd, …).
OrdText38Numeric formatting. Ordinal text (First, Second, Third, …).
UppercaseRoman39Numeric formatting. Uppercase Roman (I, II, III, …).
LowercaseRoman40Numeric formatting. Lowercase Roman (i, ii, iii, …).
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.
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.
Caps49Text formatting. Capitalizes the first letter of each word.
FirstCap50Text formatting. Capitalizes the first letter of the first word.
Lower51Text formatting. All letters are lowercase.
Upper52Text formatting. All letters are uppercase.
CharFormat53Field result formatting. The CHARFORMAT instruction.
MergeFormat54Field result formatting. The MERGEFORMAT instruction.
MergeFormatInet55Field result formatting. The MERGEFORMATINET instruction.

Examples

Shows how to format field results.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

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

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

// 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:
SharedPtr<FieldFormat> format = field->get_Format();
format->set_NumericFormat(u"$###.00");
field->Update();

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

// 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(u"DATE \\@ \"dddd, MMMM dd, yyyy\"", field->GetFieldCode());
std::cout << "Today's date, in " << format->get_DateTimeFormat() << " format:\n\t" << 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();

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

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

// 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(0, format->get_GeneralFormats()->get_Count());
field->Update();

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

See Also