public class NumberStyle
extends java.lang.Object
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 docList = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);
ListLevel listLevel = docList.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 = docList.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("");
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(docList);
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");
| Modifier and Type | Field and Description |
|---|---|
static int |
AIUEO
Aiueo full width
|
static int |
AIUEO_HALF_WIDTH
Aiueo
|
static int |
ARABIC
Arabic numbering (1, 2, 3, ...)
|
static int |
ARABIC_1
Arabic alpha
|
static int |
ARABIC_2
Arabic abjad
|
static int |
ARABIC_FULL_WIDTH
Full-width Arabic: 1, 2, 3, 4
|
static int |
ARABIC_HALF_WIDTH
Half-width Arabic: 1, 2, 3, 4
|
static int |
BULLET
Bullet (check the character code in the text)
|
static int |
CHICAGO_MANUAL
Chicago Manual of Style: *, †, †
|
static int |
CHOSUNG
Korea Chosung
|
static int |
CUSTOM
Custom number format.
|
static int |
DECIMAL_FULL_WIDTH
Decimal full width: 1, 2, 3, 4
|
static int |
GANADA
Korean Ganada
|
static int |
GB_1
Enclosed full stop
|
static int |
GB_2
Enclosed parenthesis
|
static int |
GB_3
Enclosed circle Chinese
|
static int |
GB_4
Ideograph enclosed circle
|
static int |
HANGUL
Korea legal
|
static int |
HANJA
Korea digital2
|
static int |
HANJA_READ
Korean digital
|
static int |
HANJA_READ_DIGIT
Korean counting
|
static int |
HEBREW_1
Hebrew-1
|
static int |
HEBREW_2
Hebrew-2
|
static int |
HEX
Hexadecimal: 8, 9, A, B, C, D, E, F, 10, 11, 12
|
static int |
HINDI_ARABIC
Hindi numbers
|
static int |
HINDI_CARDINAL_TEXT
Hindi descriptive (cardinals)
|
static int |
HINDI_LETTER_1
Hindi vowels
|
static int |
HINDI_LETTER_2
Hindi consonants
|
static int |
IROHA
Iroha full width
|
static int |
IROHA_HALF_WIDTH
Iroha
|
static int |
KANJI
Ideograph-digital
|
static int |
KANJI_DIGIT
Japanese counting
|
static int |
KANJI_TRADITIONAL
Japanese legal
|
static int |
KANJI_TRADITIONAL_2
Japanese digital ten thousand
|
static int |
LEADING_ZERO
Leading Zero (01, 02,..., 09, 10, 11,..., 99, 100, 101,...)
|
static int |
length |
static int |
LOWERCASE_LETTER
Lower case letter (a, b, c, ...)
|
static int |
LOWERCASE_ROMAN
Lower case Roman (i, ii, iii, ...)
|
static int |
LOWERCASE_RUSSIAN
Lowercase Russian alphabet
|
static int |
NONE
No bullet or number.
|
static int |
NUMBER
Numbered (One, Two, Three, ...)
|
static int |
NUMBER_IN_CIRCLE
Enclosed circles
|
static int |
NUMBER_IN_DASH
Page number format: - 1 -, - 2 -, - 3 -, - 4 -
|
static int |
ORDINAL
Ordinal (1st, 2nd, 3rd, ...)
|
static int |
ORDINAL_TEXT
Ordinal (text) (First, Second, Third, ...)
|
static int |
SIMP_CHIN_NUM_1
Chinese counting
|
static int |
SIMP_CHIN_NUM_2
Chinese legal simplified
|
static int |
SIMP_CHIN_NUM_3
Chinese counting thousand
|
static int |
SIMP_CHIN_NUM_4
Chinese (not implemented)
|
static int |
THAI_ARABIC
Thai numbers
|
static int |
THAI_CARDINAL_TEXT
Thai descriptive (cardinals)
|
static int |
THAI_LETTER
Thai letters
|
static int |
TRAD_CHIN_NUM_1
Taiwanese counting
|
static int |
TRAD_CHIN_NUM_2
Ideograph legal traditional
|
static int |
TRAD_CHIN_NUM_3
Taiwanese counting thousand
|
static int |
TRAD_CHIN_NUM_4
Taiwanese digital
|
static int |
UPPERCASE_LETTER
Upper case Letter (A, B, C, ...)
|
static int |
UPPERCASE_ROMAN
Upper case Roman (I, II, III, ...)
|
static int |
UPPERCASE_RUSSIAN
Uppercase Russian alphabet
|
static int |
VIET_CARDINAL_TEXT
Vietnamese descriptive (cardinals)
|
static int |
ZODIAC_1
Ideograph traditional
|
static int |
ZODIAC_2
Ideograph Zodiac
|
static int |
ZODIAC_3
Ideograph Zodiac traditional
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String numberStyleName) |
static java.lang.String |
getName(int numberStyle) |
static int[] |
getValues() |
static java.lang.String |
toString(int numberStyle) |
public static int ARABIC
public static int UPPERCASE_ROMAN
public static int LOWERCASE_ROMAN
public static int UPPERCASE_LETTER
public static int LOWERCASE_LETTER
public static int ORDINAL
public static int NUMBER
public static int ORDINAL_TEXT
public static int HEX
public static int CHICAGO_MANUAL
public static int KANJI
public static int KANJI_DIGIT
public static int AIUEO_HALF_WIDTH
public static int IROHA_HALF_WIDTH
public static int ARABIC_FULL_WIDTH
public static int ARABIC_HALF_WIDTH
public static int KANJI_TRADITIONAL
public static int KANJI_TRADITIONAL_2
public static int NUMBER_IN_CIRCLE
public static int DECIMAL_FULL_WIDTH
public static int AIUEO
public static int IROHA
public static int LEADING_ZERO
public static int BULLET
public static int GANADA
public static int CHOSUNG
public static int GB_1
public static int GB_2
public static int GB_3
public static int GB_4
public static int ZODIAC_1
public static int ZODIAC_2
public static int ZODIAC_3
public static int TRAD_CHIN_NUM_1
public static int TRAD_CHIN_NUM_2
public static int TRAD_CHIN_NUM_3
public static int TRAD_CHIN_NUM_4
public static int SIMP_CHIN_NUM_1
public static int SIMP_CHIN_NUM_2
public static int SIMP_CHIN_NUM_3
public static int SIMP_CHIN_NUM_4
public static int HANJA_READ
public static int HANJA_READ_DIGIT
public static int HANGUL
public static int HANJA
public static int HEBREW_1
public static int ARABIC_1
public static int HEBREW_2
public static int ARABIC_2
public static int HINDI_LETTER_1
public static int HINDI_LETTER_2
public static int HINDI_ARABIC
public static int HINDI_CARDINAL_TEXT
public static int THAI_LETTER
public static int THAI_ARABIC
public static int THAI_CARDINAL_TEXT
public static int VIET_CARDINAL_TEXT
public static int NUMBER_IN_DASH
public static int LOWERCASE_RUSSIAN
public static int UPPERCASE_RUSSIAN
public static int NONE
public static int CUSTOM
public static int length