GeneralFormat

GeneralFormat enumeration

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

public enum 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.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

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

Assert.AreEqual("= 2 + 3", field.GetFieldCode());
Assert.AreEqual("5", field.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:
FieldFormat format = field.Format;
format.NumericFormat = "$###.00";
field.Update();

Assert.AreEqual("= 2 + 3 \\# $###.00", field.GetFieldCode());
Assert.AreEqual("$  5.00", field.Result);

// 2 -  Date/time format:
field = builder.InsertField("DATE");
format = field.Format;
format.DateTimeFormat = "dddd, MMMM dd, yyyy";
field.Update();

Assert.AreEqual("DATE \\@ \"dddd, MMMM dd, yyyy\"", field.GetFieldCode());
Console.WriteLine($"Today's date, in {format.DateTimeFormat} format:\n\t{field.Result}");

// 3 -  General format:
field = builder.InsertField("= 25 + 33");
format = field.Format;
format.GeneralFormats.Add(GeneralFormat.LowercaseRoman);
format.GeneralFormats.Add(GeneralFormat.Upper);
field.Update();

int index = 0;
using (IEnumerator<GeneralFormat> generalFormatEnumerator = format.GeneralFormats.GetEnumerator())
    while (generalFormatEnumerator.MoveNext())
        Console.WriteLine($"General format index {index++}: {generalFormatEnumerator.Current}");

Assert.AreEqual("= 25 + 33 \\* roman \\* Upper", field.GetFieldCode());
Assert.AreEqual("LVIII", field.Result);
Assert.AreEqual(2, format.GeneralFormats.Count);
Assert.AreEqual(GeneralFormat.LowercaseRoman, format.GeneralFormats[0]);

// We can remove our formats to revert the field's result to its original form.
format.GeneralFormats.Remove(GeneralFormat.LowercaseRoman);
format.GeneralFormats.RemoveAt(0);
Assert.AreEqual(0, format.GeneralFormats.Count);
field.Update();

Assert.AreEqual("= 25 + 33  ", field.GetFieldCode());
Assert.AreEqual("58", field.Result);
Assert.AreEqual(0, format.GeneralFormats.Count);

See Also