public class FieldSymbol extends Field
To learn more, visit the Working with Fields documentation article.
Remarks:
Retrieves the character whose code point value is specified in decimal or hexadecimal.
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCharacterCode()
Gets the character's code point value in decimal or hexadecimal.
|
boolean |
getDontAffectsLineSpacing()
Gets whether the character retrieved by the field affects the line spacing of the paragraph.
|
java.lang.String |
getFontName()
Gets the name of the font of the character retrieved by the field.
|
java.lang.String |
getFontSize()
Gets the size in points of the font of the character retrieved by the field.
|
int |
getSwitchType(java.lang.String switchName) |
boolean |
isAnsi()
Gets whether the character code is interpreted as the value of an ANSI character.
|
void |
isAnsi(boolean value)
Sets whether the character code is interpreted as the value of an ANSI character.
|
boolean |
isShiftJis()
Gets whether the character code is interpreted as the value of a SHIFT-JIS character.
|
void |
isShiftJis(boolean value)
Sets whether the character code is interpreted as the value of a SHIFT-JIS character.
|
boolean |
isUnicode()
Gets whether the character code is interpreted as the value of a Unicode character.
|
void |
isUnicode(boolean value)
Sets whether the character code is interpreted as the value of a Unicode character.
|
void |
setCharacterCode(java.lang.String value)
Sets the character's code point value in decimal or hexadecimal.
|
void |
setDontAffectsLineSpacing(boolean value)
Sets whether the character retrieved by the field affects the line spacing of the paragraph.
|
void |
setFontName(java.lang.String value)
Sets the name of the font of the character retrieved by the field.
|
void |
setFontSize(java.lang.String value)
Sets the size in points of the font of the character retrieved by the field.
|
getDisplayResult, getEnd, getFieldCode, getFieldCode, getFormat, getLocaleId, getResult, getSeparator, getStart, getType, isDirty, isDirty, isLocked, isLocked, needStoreOldResultNodes, remove, setLocaleId, setResult, unlink, update, updatepublic java.lang.String getCharacterCode()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void setCharacterCode(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - The character's code point value in decimal or hexadecimal.java.lang.Exceptionpublic int getSwitchType(java.lang.String switchName)
public java.lang.String getFontName()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void setFontName(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - The name of the font of the character retrieved by the field.java.lang.Exceptionpublic java.lang.String getFontSize()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void setFontSize(java.lang.String value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - The size in points of the font of the character retrieved by the field.java.lang.Exceptionpublic boolean isAnsi()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void isAnsi(boolean value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - Whether the character code is interpreted as the value of an ANSI character.java.lang.Exceptionpublic boolean isUnicode()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void isUnicode(boolean value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - Whether the character code is interpreted as the value of a Unicode character.java.lang.Exceptionpublic boolean isShiftJis()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void isShiftJis(boolean value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - Whether the character code is interpreted as the value of a SHIFT-JIS character.java.lang.Exceptionpublic boolean getDontAffectsLineSpacing()
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
public void setDontAffectsLineSpacing(boolean value)
throws java.lang.Exception
Examples:
Shows how to use the SYMBOL field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Below are three ways to use a SYMBOL field to display a single character.
// 1 - Add a SYMBOL field which displays the © (Copyright) symbol, specified by an ANSI character code:
FieldSymbol field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// The ANSI character code "U+00A9", or "169" in integer form, is reserved for the copyright symbol.
field.setCharacterCode(Integer.toString(0x00a9));
field.isAnsi(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 169 \\a");
builder.writeln(" Line 1");
// 2 - Add a SYMBOL field which displays the ∞ (Infinity) symbol, and modify its appearance:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
// In Unicode, the infinity symbol occupies the "221E" code.
field.setCharacterCode(Integer.toString(0x221E));
field.isUnicode(true);
// Change the font of our symbol after using the Windows Character Map
// to ensure that the font can represent that symbol.
field.setFontName("Calibri");
field.setFontSize("24");
// We can set this flag for tall symbols to make them not push down the rest of the text on their line.
field.setDontAffectsLineSpacing(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 8734 \\u \\f Calibri \\s 24 \\h");
builder.writeln("Line 2");
// 3 - Add a SYMBOL field which displays the あ character,
// with a font that supports Shift-JIS (Windows-932) codepage:
field = (FieldSymbol) builder.insertField(FieldType.FIELD_SYMBOL, true);
field.setFontName("MS Gothic");
field.setCharacterCode(Integer.toString(0x82A0));
field.isShiftJis(true);
Assert.assertEquals(field.getFieldCode(), " SYMBOL 33440 \\f \"MS Gothic\" \\j");
builder.write("Line 3");
doc.save(getArtifactsDir() + "Field.SYMBOL.docx");
value - Whether the character retrieved by the field affects the line spacing of the paragraph.java.lang.Exception