NumberStyle
Inheritance: java.lang.Object
public class NumberStyle
Specifies the number style for a list, footnotes and endnotes, page numbers.
Examples:
Shows how to apply custom list formatting to paragraphs when using DocumentBuilder.
Document doc = new Document();
// A list allows us to organize and decorate sets of paragraphs with prefix symbols and indents.
// We can create nested lists by increasing the indent level.
// We can begin and end a list by using a document builder's "ListFormat" property.
// Each paragraph that we add between a list's start and the end will become an item in the list.
// Create a list from a Microsoft Word template, and customize the first two of its list levels.
List list = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);
ListLevel listLevel = list.getListLevels().get(0);
listLevel.getFont().setColor(Color.RED);
listLevel.getFont().setSize(24.0);
listLevel.setNumberStyle(NumberStyle.ORDINAL_TEXT);
listLevel.setStartAt(21);
listLevel.setNumberFormat("");
listLevel.setNumberPosition(-36);
listLevel.setTextPosition(144.0);
listLevel.setTabPosition(144.0);
listLevel = list.getListLevels().get(1);
listLevel.setAlignment(ListLevelAlignment.RIGHT);
listLevel.setNumberStyle(NumberStyle.BULLET);
listLevel.getFont().setName("Wingdings");
listLevel.getFont().setColor(Color.BLUE);
listLevel.getFont().setSize(24.0);
// This NumberFormat value will create star-shaped bullet list symbols.
listLevel.setNumberFormat("\uf0af");
listLevel.setTrailingCharacter(ListTrailingCharacter.SPACE);
listLevel.setNumberPosition(144.0);
// Create paragraphs and apply both list levels of our custom list formatting to them.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.getListFormat().setList(list);
builder.writeln("The quick brown fox...");
builder.writeln("The quick brown fox...");
builder.getListFormat().listIndent();
builder.writeln("jumped over the lazy dog.");
builder.writeln("jumped over the lazy dog.");
builder.getListFormat().listOutdent();
builder.writeln("The quick brown fox...");
builder.getListFormat().removeNumbers();
builder.getDocument().save(getArtifactsDir() + "Lists.CreateCustomList.docx");
Fields
Field | Description |
---|---|
AIUEO | Aiueo full width |
AIUEO_HALF_WIDTH | Aiueo |
ARABIC | Arabic numbering (1, 2, 3, …) |
ARABIC_1 | Arabic alpha |
ARABIC_2 | Arabic abjad |
ARABIC_FULL_WIDTH | Full-width Arabic: 1, 2, 3, 4 |
ARABIC_HALF_WIDTH | Half-width Arabic: 1, 2, 3, 4 |
BULLET | Bullet (check the character code in the text) |
CHICAGO_MANUAL | Chicago Manual of Style: *, \u2020, \u2020 |
CHOSUNG | Korea Chosung |
CUSTOM | Custom number format. |
DECIMAL_FULL_WIDTH | Decimal full width: 1, 2, 3, 4 |
GANADA | Korean Ganada |
GB_1 | Enclosed full stop |
GB_2 | Enclosed parenthesis |
GB_3 | Enclosed circle Chinese |
GB_4 | Ideograph enclosed circle |
HANGUL | Korea legal |
HANJA | Korea digital2 |
HANJA_READ | Korean digital |
HANJA_READ_DIGIT | Korean counting |
HEBREW_1 | Hebrew-1 |
HEBREW_2 | Hebrew-2 |
HEX | Hexadecimal: 8, 9, A, B, C, D, E, F, 10, 11, 12 |
HINDI_ARABIC | Hindi numbers |
HINDI_CARDINAL_TEXT | Hindi descriptive (cardinals) |
HINDI_LETTER_1 | Hindi vowels |
HINDI_LETTER_2 | Hindi consonants |
IROHA | Iroha full width |
IROHA_HALF_WIDTH | Iroha |
KANJI | Ideograph-digital |
KANJI_DIGIT | Japanese counting |
KANJI_TRADITIONAL | Japanese legal |
KANJI_TRADITIONAL_2 | Japanese digital ten thousand |
LEADING_ZERO | Leading Zero (01, 02,…, 09, 10, 11,…, 99, 100, 101,…) |
LOWERCASE_LETTER | Lower case letter (a, b, c, …) |
LOWERCASE_ROMAN | Lower case Roman (i, ii, iii, …) |
LOWERCASE_RUSSIAN | Lowercase Russian alphabet |
NONE | No bullet or number. |
NUMBER | Numbered (One, Two, Three, …) |
NUMBER_IN_CIRCLE | Enclosed circles |
NUMBER_IN_DASH | Page number format: - 1 -, - 2 -, - 3 -, - 4 - |
ORDINAL | Ordinal (1st, 2nd, 3rd, …) |
ORDINAL_TEXT | Ordinal (text) (First, Second, Third, …) |
SIMP_CHIN_NUM_1 | Chinese counting |
SIMP_CHIN_NUM_2 | Chinese legal simplified |
SIMP_CHIN_NUM_3 | Chinese counting thousand |
SIMP_CHIN_NUM_4 | Chinese (not implemented) |
THAI_ARABIC | Thai numbers |
THAI_CARDINAL_TEXT | Thai descriptive (cardinals) |
THAI_LETTER | Thai letters |
TRAD_CHIN_NUM_1 | Taiwanese counting |
TRAD_CHIN_NUM_2 | Ideograph legal traditional |
TRAD_CHIN_NUM_3 | Taiwanese counting thousand |
TRAD_CHIN_NUM_4 | Taiwanese digital |
UPPERCASE_LETTER | Upper case Letter (A, B, C, …) |
UPPERCASE_ROMAN | Upper case Roman (I, II, III, …) |
UPPERCASE_RUSSIAN | Uppercase Russian alphabet |
VIET_CARDINAL_TEXT | Vietnamese descriptive (cardinals) |
ZODIAC_1 | Ideograph traditional |
ZODIAC_2 | Ideograph Zodiac |
ZODIAC_3 | Ideograph Zodiac traditional |
length |
Methods
Method | Description |
---|---|
fromName(String numberStyleName) | |
getName(int numberStyle) | |
getValues() | |
toString(int numberStyle) |
AIUEO
public static int AIUEO
Aiueo full width
AIUEO_HALF_WIDTH
public static int AIUEO_HALF_WIDTH
Aiueo
ARABIC
public static int ARABIC
Arabic numbering (1, 2, 3, …)
ARABIC_1
public static int ARABIC_1
Arabic alpha
ARABIC_2
public static int ARABIC_2
Arabic abjad
ARABIC_FULL_WIDTH
public static int ARABIC_FULL_WIDTH
Full-width Arabic: 1, 2, 3, 4
ARABIC_HALF_WIDTH
public static int ARABIC_HALF_WIDTH
Half-width Arabic: 1, 2, 3, 4
BULLET
public static int BULLET
Bullet (check the character code in the text)
CHICAGO_MANUAL
public static int CHICAGO_MANUAL
Chicago Manual of Style: *, \u2020, \u2020
CHOSUNG
public static int CHOSUNG
Korea Chosung
CUSTOM
public static int CUSTOM
Custom number format. It is supported by DOCX format only.
DECIMAL_FULL_WIDTH
public static int DECIMAL_FULL_WIDTH
Decimal full width: 1, 2, 3, 4
GANADA
public static int GANADA
Korean Ganada
GB_1
public static int GB_1
Enclosed full stop
GB_2
public static int GB_2
Enclosed parenthesis
GB_3
public static int GB_3
Enclosed circle Chinese
GB_4
public static int GB_4
Ideograph enclosed circle
HANGUL
public static int HANGUL
Korea legal
HANJA
public static int HANJA
Korea digital2
HANJA_READ
public static int HANJA_READ
Korean digital
HANJA_READ_DIGIT
public static int HANJA_READ_DIGIT
Korean counting
HEBREW_1
public static int HEBREW_1
Hebrew-1
HEBREW_2
public static int HEBREW_2
Hebrew-2
HEX
public static int HEX
Hexadecimal: 8, 9, A, B, C, D, E, F, 10, 11, 12
HINDI_ARABIC
public static int HINDI_ARABIC
Hindi numbers
HINDI_CARDINAL_TEXT
public static int HINDI_CARDINAL_TEXT
Hindi descriptive (cardinals)
HINDI_LETTER_1
public static int HINDI_LETTER_1
Hindi vowels
HINDI_LETTER_2
public static int HINDI_LETTER_2
Hindi consonants
IROHA
public static int IROHA
Iroha full width
IROHA_HALF_WIDTH
public static int IROHA_HALF_WIDTH
Iroha
KANJI
public static int KANJI
Ideograph-digital
KANJI_DIGIT
public static int KANJI_DIGIT
Japanese counting
KANJI_TRADITIONAL
public static int KANJI_TRADITIONAL
Japanese legal
KANJI_TRADITIONAL_2
public static int KANJI_TRADITIONAL_2
Japanese digital ten thousand
LEADING_ZERO
public static int LEADING_ZERO
Leading Zero (01, 02,…, 09, 10, 11,…, 99, 100, 101,…)
LOWERCASE_LETTER
public static int LOWERCASE_LETTER
Lower case letter (a, b, c, …)
LOWERCASE_ROMAN
public static int LOWERCASE_ROMAN
Lower case Roman (i, ii, iii, …)
LOWERCASE_RUSSIAN
public static int LOWERCASE_RUSSIAN
Lowercase Russian alphabet
NONE
public static int NONE
No bullet or number.
NUMBER
public static int NUMBER
Numbered (One, Two, Three, …)
NUMBER_IN_CIRCLE
public static int NUMBER_IN_CIRCLE
Enclosed circles
NUMBER_IN_DASH
public static int NUMBER_IN_DASH
Page number format: - 1 -, - 2 -, - 3 -, - 4 -
ORDINAL
public static int ORDINAL
Ordinal (1st, 2nd, 3rd, …)
ORDINAL_TEXT
public static int ORDINAL_TEXT
Ordinal (text) (First, Second, Third, …)
SIMP_CHIN_NUM_1
public static int SIMP_CHIN_NUM_1
Chinese counting
SIMP_CHIN_NUM_2
public static int SIMP_CHIN_NUM_2
Chinese legal simplified
SIMP_CHIN_NUM_3
public static int SIMP_CHIN_NUM_3
Chinese counting thousand
SIMP_CHIN_NUM_4
public static int SIMP_CHIN_NUM_4
Chinese (not implemented)
THAI_ARABIC
public static int THAI_ARABIC
Thai numbers
THAI_CARDINAL_TEXT
public static int THAI_CARDINAL_TEXT
Thai descriptive (cardinals)
THAI_LETTER
public static int THAI_LETTER
Thai letters
TRAD_CHIN_NUM_1
public static int TRAD_CHIN_NUM_1
Taiwanese counting
TRAD_CHIN_NUM_2
public static int TRAD_CHIN_NUM_2
Ideograph legal traditional
TRAD_CHIN_NUM_3
public static int TRAD_CHIN_NUM_3
Taiwanese counting thousand
TRAD_CHIN_NUM_4
public static int TRAD_CHIN_NUM_4
Taiwanese digital
UPPERCASE_LETTER
public static int UPPERCASE_LETTER
Upper case Letter (A, B, C, …)
UPPERCASE_ROMAN
public static int UPPERCASE_ROMAN
Upper case Roman (I, II, III, …)
UPPERCASE_RUSSIAN
public static int UPPERCASE_RUSSIAN
Uppercase Russian alphabet
VIET_CARDINAL_TEXT
public static int VIET_CARDINAL_TEXT
Vietnamese descriptive (cardinals)
ZODIAC_1
public static int ZODIAC_1
Ideograph traditional
ZODIAC_2
public static int ZODIAC_2
Ideograph Zodiac
ZODIAC_3
public static int ZODIAC_3
Ideograph Zodiac traditional
length
public static int length
fromName(String numberStyleName)
public static int fromName(String numberStyleName)
Parameters:
Parameter | Type | Description |
---|---|---|
numberStyleName | java.lang.String |
Returns: int
getName(int numberStyle)
public static String getName(int numberStyle)
Parameters:
Parameter | Type | Description |
---|---|---|
numberStyle | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int numberStyle)
public static String toString(int numberStyle)
Parameters:
Parameter | Type | Description |
---|---|---|
numberStyle | int |
Returns: java.lang.String