GeneralFormat enumeration

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.

Members

NameDescription
NONEUsed to specify a missing general format.
AIUEONumeric formatting. Formats a numeric result using hiragana characters in the traditional a-i-u-e-o order.
UPPERCASE_ALPHABETICNumeric formatting. Formats a numeric result as one or more occurrences of an uppercase alphabetic Latin character.
LOWERCASE_ALPHABETICNumeric formatting. Formats a numeric result as one or more occurrences of an lowercase alphabetic Latin character.
ARABICNumeric formatting. Formats a numeric result using Arabic cardinal numerals.
ARABIC_ABJADNumeric formatting. Formats a numeric result using ascending Abjad numerals.
ARABIC_ALPHANumeric formatting. Formats a numeric result using characters in the Arabic alphabet.
ARABIC_DASHNumeric formatting. Formats a numeric result using Arabic cardinal numerals, with a prefix of “- " and a suffix of " -”.
BAHT_TEXTNumeric formatting. Formats a numeric result in the Thai counting system.
CARD_TEXTNumeric formatting. Cardinal text (One, Two, Three, …).
CHINESE_NUM1Numeric formatting. Formats a numeric result using ascending numbers from the appropriate counting system.
CHINESE_NUM2Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal format.
CHINESE_NUM3Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting thousand system.
CHOSUNGNumeric formatting. Formats a numeric result using sequential numbers from the Korean Chosung format.
CIRCLE_NUMNumeric 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.
DB_CHARNumeric formatting. Formats a numeric result using double-byte Arabic numbering.
DB_NUM1Numeric formatting. Formats a numeric result using sequential digital ideographs, using the appropriate character.
DB_NUM2Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting system.
DB_NUM3Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal counting system.
DB_NUM4Numeric formatting. Formats a numeric result using sequential numbers from the appropriate digital counting system.
DOLLAR_TEXTNumeric formatting. Dollar text (One, Two, Three, … + AND 55/100).
GANADANumeric formatting. Formats a numeric result using sequential numbers from the Korean Ganada format.
GB1Numeric formatting. Formats a numeric result using decimal numbering followed by a period, using the enclosed alphanumeric glyph character.
GB2Numeric formatting. Formats a numeric result using decimal numbering enclosed in parenthesis, using the enclosed alphanumeric glyph character.
GB3Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
GB4Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
HEBREW1Numeric formatting. Formats a numeric result using Hebrew numerals.
HEBREW2Numeric formatting. Formats a numeric result using the Hebrew alphabet.
HEXNumeric formatting. Formats the numeric result using uppercase hexadecimal digits.
HINDI_ARABICNumeric formatting. Formats a numeric result using Hindi numbers.
HINDI_CARD_TEXTNumeric formatting. Formats a numeric result using sequential numbers from the Hindi counting system.
HINDI_LETTER1Numeric formatting. Formats a numeric result using Hindi vowels.
HINDI_LETTER2Numeric formatting. Formats a numeric result using Hindi consonants.
IROHANumeric formatting. Formats a numeric result using the Japanese iroha.
KANJI_NUM1Numeric formatting. Formats a numeric result using a Japanese style using the appropriate counting system.
KANJI_NUM2Numeric formatting. Formats a numeric result using the appropriate counting system.
KANJI_NUM3Numeric formatting. Formats a numeric result using the appropriate counting system.
ORDINALNumeric formatting. Ordinal (1st, 2nd, 3rd, …).
ORD_TEXTNumeric formatting. Ordinal text (First, Second, Third, …).
UPPERCASE_ROMANNumeric formatting. Uppercase Roman (I, II, III, …).
LOWERCASE_ROMANNumeric formatting. Lowercase Roman (i, ii, iii, …).
SB_CHARNumeric formatting. Formats a numeric result using single-byte Arabic numbering.
THAI_ARABICNumeric formatting. Formats a numeric result using Thai numbers.
THAI_CARD_TEXTNumeric formatting. Formats a numeric result using sequential numbers from the Thai counting system.
THAI_LETTERNumeric formatting. Formats a numeric result using Thai letters.
VIET_CARD_TEXTNumeric formatting. Formats a numeric result using Vietnamese numerals.
ZODIAC1Numeric formatting. Formats a numeric result using sequential numerical traditional ideographs.
ZODIAC2Numeric formatting. Formats a numeric result using sequential zodiac ideographs.
ZODIAC3Numeric formatting. Formats a numeric result using sequential traditional zodiac ideographs.
CAPSText formatting. Capitalizes the first letter of each word.
FIRST_CAPText formatting. Capitalizes the first letter of the first word.
LOWERText formatting. All letters are lowercase.
UPPERText formatting. All letters are uppercase.
CHAR_FORMATField result formatting. The CHARFORMAT instruction.
MERGE_FORMATField result formatting. The MERGEFORMAT instruction.
MERGE_FORMAT_INETField result formatting. The MERGEFORMATINET instruction.

Examples

Shows how to format field results.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Use a document builder to insert a field that displays a result with no format applied.
field = builder.insert_field("= 2 + 3")

self.assertEqual("= 2 + 3", field.get_field_code())
self.assertEqual("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:
format = field.format
format.numeric_format = "$###.00"
field.update()

self.assertEqual("= 2 + 3 \\# $###.00", field.get_field_code())
self.assertEqual("$  5.00", field.result)

# 2 -  Date/time format:
field = builder.insert_field("DATE")
format = field.format
format.date_time_format = "dddd, MMMM dd, yyyy"
field.update()

self.assertEqual("DATE \\@ \"dddd, MMMM dd, yyyy\"", field.get_field_code())
print(f"Today's date, in {format.date_time_format} format:\n\t{field.result}")

# 3 -  General format:
field = builder.insert_field("= 25 + 33")
format = field.format
format.general_formats.add(aw.fields.GeneralFormat.LOWERCASE_ROMAN)
format.general_formats.add(aw.fields.GeneralFormat.UPPER)
field.update()

for index, general_format in enumerate(format.general_formats):
    print(f"General format index {index}: {general_format}")

self.assertEqual("= 25 + 33 \\* roman \\* Upper", field.get_field_code())
self.assertEqual("LVIII", field.result)
self.assertEqual(2, format.general_formats.count)
self.assertEqual(aw.fields.GeneralFormat.LOWERCASE_ROMAN, format.general_formats[0])

# We can remove our formats to revert the field's result to its original form.
format.general_formats.remove(aw.fields.GeneralFormat.LOWERCASE_ROMAN)
format.general_formats.remove_at(0)
self.assertEqual(0, format.general_formats.count)
field.update()

self.assertEqual("= 25 + 33  ", field.get_field_code())
self.assertEqual("58", field.result)
self.assertEqual(0, format.general_formats.count)

See Also