com.aspose.words

Class GeneralFormat

  • java.lang.Object
    • com.aspose.words.GeneralFormat
public class GeneralFormat 
extends java.lang.Object

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

Example:

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.assertEquals("= 2 + 3", field.getFieldCode());
Assert.assertEquals("5", field.getResult());

// We can apply a format to a field's result using the field's attributes.
// Below are three types of formats that we can apply to a field's result.
// 1 -  Numeric format:
FieldFormat format = field.getFormat();
format.setNumericFormat("$###.00");
field.update();

Assert.assertEquals("= 2 + 3 \\# $###.00", field.getFieldCode());
Assert.assertEquals("$  5.00", field.getResult());

// 2 -  Date/time format:
field = builder.insertField("DATE");
format = field.getFormat();
format.setDateTimeFormat("dddd, MMMM dd, yyyy");
field.update();

Assert.assertEquals("DATE \\@ \"dddd, MMMM dd, yyyy\"", field.getFieldCode());
System.out.println("Today's date, in {format.DateTimeFormat} format:\n\t{field.Result}");

// 3 -  General format:
field = builder.insertField("= 25 + 33");
format = field.getFormat();
format.getGeneralFormats().add(GeneralFormat.LOWERCASE_ROMAN);
format.getGeneralFormats().add(GeneralFormat.UPPER);
field.update();

int index = 0;
Iterator<Integer> generalFormatEnumerator = format.getGeneralFormats().iterator();
while (generalFormatEnumerator.hasNext()) {
    int value = generalFormatEnumerator.next();
    System.out.println(MessageFormat.format("General format index {0}: {1}", index++, value));
}

Assert.assertEquals("= 25 + 33 \\* roman \\* Upper", field.getFieldCode());
Assert.assertEquals("LVIII", field.getResult());
Assert.assertEquals(2, format.getGeneralFormats().getCount());
Assert.assertEquals(GeneralFormat.LOWERCASE_ROMAN, format.getGeneralFormats().get(0));

// We can remove our formats to revert the field's result to its original form.
format.getGeneralFormats().remove(GeneralFormat.LOWERCASE_ROMAN);
format.getGeneralFormats().removeAt(0);
Assert.assertEquals(0, format.getGeneralFormats().getCount());
field.update();

Assert.assertEquals("= 25 + 33  ", field.getFieldCode());
Assert.assertEquals("58", field.getResult());
Assert.assertEquals(0, format.getGeneralFormats().getCount());

Field Summary
static final intNONE = 0
Used to specify a missing general format.
static final intAIUEO = 1
Numeric formatting. Formats a numeric result using hiragana characters in the traditional a-i-u-e-o order.
static final intUPPERCASE_ALPHABETIC = 2
Numeric formatting. Formats a numeric result as one or more occurrences of an uppercase alphabetic Latin character.
static final intLOWERCASE_ALPHABETIC = 3
Numeric formatting. Formats a numeric result as one or more occurrences of an lowercase alphabetic Latin character.
static final intARABIC = 4
Numeric formatting. Formats a numeric result using Arabic cardinal numerals.
static final intARABIC_ABJAD = 5
Numeric formatting. Formats a numeric result using ascending Abjad numerals.
static final intARABIC_ALPHA = 6
Numeric formatting. Formats a numeric result using characters in the Arabic alphabet.
static final intARABIC_DASH = 7
Numeric formatting. Formats a numeric result using Arabic cardinal numerals, with a prefix of "- " and a suffix of " -".
static final intBAHT_TEXT = 8
Numeric formatting. Formats a numeric result in the Thai counting system.
static final intCARD_TEXT = 9
Numeric formatting. Cardinal text (One, Two, Three, ...).
static final intCHINESE_NUM_1 = 10
Numeric formatting. Formats a numeric result using ascending numbers from the appropriate counting system.
static final intCHINESE_NUM_2 = 11
Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal format.
static final intCHINESE_NUM_3 = 12
Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting thousand system.
static final intCHOSUNG = 13
Numeric formatting. Formats a numeric result using sequential numbers from the Korean Chosung format.
static final intCIRCLE_NUM = 14
Numeric 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.
static final intDB_CHAR = 15
Numeric formatting. Formats a numeric result using double-byte Arabic numbering.
static final intDB_NUM_1 = 16
Numeric formatting. Formats a numeric result using sequential digital ideographs, using the appropriate character.
static final intDB_NUM_2 = 17
Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting system.
static final intDB_NUM_3 = 18
Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal counting system.
static final intDB_NUM_4 = 19
Numeric formatting. Formats a numeric result using sequential numbers from the appropriate digital counting system.
static final intDOLLAR_TEXT = 20
Numeric formatting. Dollar text (One, Two, Three, ... + AND 55/100).
static final intGANADA = 21
Numeric formatting. Formats a numeric result using sequential numbers from the Korean Ganada format.
static final intGB_1 = 22
Numeric formatting. Formats a numeric result using decimal numbering followed by a period, using the enclosed alphanumeric glyph character.
static final intGB_2 = 23
Numeric formatting. Formats a numeric result using decimal numbering enclosed in parenthesis, using the enclosed alphanumeric glyph character.
static final intGB_3 = 24
Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
static final intGB_4 = 25
Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
static final intHEBREW_1 = 26
Numeric formatting. Formats a numeric result using Hebrew numerals.
static final intHEBREW_2 = 27
Numeric formatting. Formats a numeric result using the Hebrew alphabet.
static final intHEX = 28
Numeric formatting. Formats the numeric result using uppercase hexadecimal digits.
static final intHINDI_ARABIC = 29
Numeric formatting. Formats a numeric result using Hindi numbers.
static final intHINDI_CARD_TEXT = 30
Numeric formatting. Formats a numeric result using sequential numbers from the Hindi counting system.
static final intHINDI_LETTER_1 = 31
Numeric formatting. Formats a numeric result using Hindi vowels.
static final intHINDI_LETTER_2 = 32
Numeric formatting. Formats a numeric result using Hindi consonants.
static final intIROHA = 33
Numeric formatting. Formats a numeric result using the Japanese iroha.
static final intKANJI_NUM_1 = 34
Numeric formatting. Formats a numeric result using a Japanese style using the appropriate counting system.
static final intKANJI_NUM_2 = 35
Numeric formatting. Formats a numeric result using the appropriate counting system.
static final intKANJI_NUM_3 = 36
Numeric formatting. Formats a numeric result using the appropriate counting system.
static final intORDINAL = 37
Numeric formatting. Ordinal (1st, 2nd, 3rd, ...).
static final intORD_TEXT = 38
Numeric formatting. Ordinal text (First, Second, Third, ...).
static final intUPPERCASE_ROMAN = 39
Numeric formatting. Uppercase Roman (I, II, III, ...).
static final intLOWERCASE_ROMAN = 40
Numeric formatting. Lowercase Roman (i, ii, iii, ...).
static final intSB_CHAR = 41
Numeric formatting. Formats a numeric result using single-byte Arabic numbering.
static final intTHAI_ARABIC = 42
Numeric formatting. Formats a numeric result using Thai numbers.
static final intTHAI_CARD_TEXT = 43
Numeric formatting. Formats a numeric result using sequential numbers from the Thai counting system.
static final intTHAI_LETTER = 44
Numeric formatting. Formats a numeric result using Thai letters.
static final intVIET_CARD_TEXT = 45
Numeric formatting. Formats a numeric result using Vietnamese numerals.
static final intZODIAC_1 = 46
Numeric formatting. Formats a numeric result using sequential numerical traditional ideographs.
static final intZODIAC_2 = 47
Numeric formatting. Formats a numeric result using sequential zodiac ideographs.
static final intZODIAC_3 = 48
Numeric formatting. Formats a numeric result using sequential traditional zodiac ideographs.
static final intCAPS = 49
Text formatting. Capitalizes the first letter of each word.
static final intFIRST_CAP = 50
Text formatting. Capitalizes the first letter of the first word.
static final intLOWER = 51
Text formatting. All letters are lowercase.
static final intUPPER = 52
Text formatting. All letters are uppercase.
static final intCHAR_FORMAT = 53
Field result formatting. The CHARFORMAT instruction.
static final intMERGE_FORMAT = 54
Field result formatting. The MERGEFORMAT instruction.
static final intMERGE_FORMAT_INET = 55
Field result formatting. The MERGEFORMATINET instruction.
 

    • Field Detail

      • NONE = 0

        public static final int NONE
        Used to specify a missing general format.
      • AIUEO = 1

        public static final int AIUEO
        Numeric formatting. Formats a numeric result using hiragana characters in the traditional a-i-u-e-o order.
      • UPPERCASE_ALPHABETIC = 2

        public static final int UPPERCASE_ALPHABETIC
        Numeric formatting. Formats a numeric result as one or more occurrences of an uppercase alphabetic Latin character.
      • LOWERCASE_ALPHABETIC = 3

        public static final int LOWERCASE_ALPHABETIC
        Numeric formatting. Formats a numeric result as one or more occurrences of an lowercase alphabetic Latin character.
      • ARABIC = 4

        public static final int ARABIC
        Numeric formatting. Formats a numeric result using Arabic cardinal numerals.
      • ARABIC_ABJAD = 5

        public static final int ARABIC_ABJAD
        Numeric formatting. Formats a numeric result using ascending Abjad numerals.
      • ARABIC_ALPHA = 6

        public static final int ARABIC_ALPHA
        Numeric formatting. Formats a numeric result using characters in the Arabic alphabet.
      • ARABIC_DASH = 7

        public static final int ARABIC_DASH
        Numeric formatting. Formats a numeric result using Arabic cardinal numerals, with a prefix of "- " and a suffix of " -".
      • BAHT_TEXT = 8

        public static final int BAHT_TEXT
        Numeric formatting. Formats a numeric result in the Thai counting system.
      • CARD_TEXT = 9

        public static final int CARD_TEXT
        Numeric formatting. Cardinal text (One, Two, Three, ...).
      • CHINESE_NUM_1 = 10

        public static final int CHINESE_NUM_1
        Numeric formatting. Formats a numeric result using ascending numbers from the appropriate counting system.
      • CHINESE_NUM_2 = 11

        public static final int CHINESE_NUM_2
        Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal format.
      • CHINESE_NUM_3 = 12

        public static final int CHINESE_NUM_3
        Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting thousand system.
      • CHOSUNG = 13

        public static final int CHOSUNG
        Numeric formatting. Formats a numeric result using sequential numbers from the Korean Chosung format.
      • CIRCLE_NUM = 14

        public static final int CIRCLE_NUM
        Numeric 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_CHAR = 15

        public static final int DB_CHAR
        Numeric formatting. Formats a numeric result using double-byte Arabic numbering.
      • DB_NUM_1 = 16

        public static final int DB_NUM_1
        Numeric formatting. Formats a numeric result using sequential digital ideographs, using the appropriate character.
      • DB_NUM_2 = 17

        public static final int DB_NUM_2
        Numeric formatting. Formats a numeric result using sequential numbers from the appropriate counting system.
      • DB_NUM_3 = 18

        public static final int DB_NUM_3
        Numeric formatting. Formats a numeric result using sequential numbers from the appropriate legal counting system.
      • DB_NUM_4 = 19

        public static final int DB_NUM_4
        Numeric formatting. Formats a numeric result using sequential numbers from the appropriate digital counting system.
      • DOLLAR_TEXT = 20

        public static final int DOLLAR_TEXT
        Numeric formatting. Dollar text (One, Two, Three, ... + AND 55/100).
      • GANADA = 21

        public static final int GANADA
        Numeric formatting. Formats a numeric result using sequential numbers from the Korean Ganada format.
      • GB_1 = 22

        public static final int GB_1
        Numeric formatting. Formats a numeric result using decimal numbering followed by a period, using the enclosed alphanumeric glyph character.
      • GB_2 = 23

        public static final int GB_2
        Numeric formatting. Formats a numeric result using decimal numbering enclosed in parenthesis, using the enclosed alphanumeric glyph character.
      • GB_3 = 24

        public static final int GB_3
        Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
      • GB_4 = 25

        public static final int GB_4
        Numeric formatting. Formats a numeric result using decimal numbering enclosed in a circle, using the enclosed alphanumeric glyph character.
      • HEBREW_1 = 26

        public static final int HEBREW_1
        Numeric formatting. Formats a numeric result using Hebrew numerals.
      • HEBREW_2 = 27

        public static final int HEBREW_2
        Numeric formatting. Formats a numeric result using the Hebrew alphabet.
      • HEX = 28

        public static final int HEX
        Numeric formatting. Formats the numeric result using uppercase hexadecimal digits.
      • HINDI_ARABIC = 29

        public static final int HINDI_ARABIC
        Numeric formatting. Formats a numeric result using Hindi numbers.
      • HINDI_CARD_TEXT = 30

        public static final int HINDI_CARD_TEXT
        Numeric formatting. Formats a numeric result using sequential numbers from the Hindi counting system.
      • HINDI_LETTER_1 = 31

        public static final int HINDI_LETTER_1
        Numeric formatting. Formats a numeric result using Hindi vowels.
      • HINDI_LETTER_2 = 32

        public static final int HINDI_LETTER_2
        Numeric formatting. Formats a numeric result using Hindi consonants.
      • IROHA = 33

        public static final int IROHA
        Numeric formatting. Formats a numeric result using the Japanese iroha.
      • KANJI_NUM_1 = 34

        public static final int KANJI_NUM_1
        Numeric formatting. Formats a numeric result using a Japanese style using the appropriate counting system.
      • KANJI_NUM_2 = 35

        public static final int KANJI_NUM_2
        Numeric formatting. Formats a numeric result using the appropriate counting system.
      • KANJI_NUM_3 = 36

        public static final int KANJI_NUM_3
        Numeric formatting. Formats a numeric result using the appropriate counting system.
      • ORDINAL = 37

        public static final int ORDINAL
        Numeric formatting. Ordinal (1st, 2nd, 3rd, ...).
      • ORD_TEXT = 38

        public static final int ORD_TEXT
        Numeric formatting. Ordinal text (First, Second, Third, ...).
      • UPPERCASE_ROMAN = 39

        public static final int UPPERCASE_ROMAN
        Numeric formatting. Uppercase Roman (I, II, III, ...).
      • LOWERCASE_ROMAN = 40

        public static final int LOWERCASE_ROMAN
        Numeric formatting. Lowercase Roman (i, ii, iii, ...).
      • SB_CHAR = 41

        public static final int SB_CHAR
        Numeric formatting. Formats a numeric result using single-byte Arabic numbering.
      • THAI_ARABIC = 42

        public static final int THAI_ARABIC
        Numeric formatting. Formats a numeric result using Thai numbers.
      • THAI_CARD_TEXT = 43

        public static final int THAI_CARD_TEXT
        Numeric formatting. Formats a numeric result using sequential numbers from the Thai counting system.
      • THAI_LETTER = 44

        public static final int THAI_LETTER
        Numeric formatting. Formats a numeric result using Thai letters.
      • VIET_CARD_TEXT = 45

        public static final int VIET_CARD_TEXT
        Numeric formatting. Formats a numeric result using Vietnamese numerals.
      • ZODIAC_1 = 46

        public static final int ZODIAC_1
        Numeric formatting. Formats a numeric result using sequential numerical traditional ideographs.
      • ZODIAC_2 = 47

        public static final int ZODIAC_2
        Numeric formatting. Formats a numeric result using sequential zodiac ideographs.
      • ZODIAC_3 = 48

        public static final int ZODIAC_3
        Numeric formatting. Formats a numeric result using sequential traditional zodiac ideographs.
      • CAPS = 49

        public static final int CAPS
        Text formatting. Capitalizes the first letter of each word.
      • FIRST_CAP = 50

        public static final int FIRST_CAP
        Text formatting. Capitalizes the first letter of the first word.
      • LOWER = 51

        public static final int LOWER
        Text formatting. All letters are lowercase.
      • UPPER = 52

        public static final int UPPER
        Text formatting. All letters are uppercase.
      • CHAR_FORMAT = 53

        public static final int CHAR_FORMAT
        Field result formatting. The CHARFORMAT instruction.
      • MERGE_FORMAT = 54

        public static final int MERGE_FORMAT
        Field result formatting. The MERGEFORMAT instruction.
      • MERGE_FORMAT_INET = 55

        public static final int MERGE_FORMAT_INET
        Field result formatting. The MERGEFORMATINET instruction.