public class TxtListIndentation
extends java.lang.Object
SaveFormat.TEXT format.
To learn more, visit the Save a Document documentation article.
Examples:
Shows how to configure list indenting when saving a document to plaintext.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list with three levels of indentation.
builder.getListFormat().applyNumberDefault();
builder.writeln("Item 1");
builder.getListFormat().listIndent();
builder.writeln("Item 2");
builder.getListFormat().listIndent();
builder.write("Item 3");
// Create a "TxtSaveOptions" object, which we can pass to the document's "Save" method
// to modify how we save the document to plaintext.
TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
// Set the "Character" property to assign a character to use
// for padding that simulates list indentation in plaintext.
txtSaveOptions.getListIndentation().setCharacter(' ');
// Set the "Count" property to specify the number of times
// to place the padding character for each list indent level.
txtSaveOptions.getListIndentation().setCount(3);
doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);
String docText = getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt";
TestUtil.fileContainsString("1. Item 1\r\n" +
" a. Item 2\r\n" +
" i. Item 3", docText);
| Modifier and Type | Method and Description |
|---|---|
char |
getCharacter()
Gets which character to use for indenting list levels.
|
int |
getCount()
Gets how many
getCharacter() / setCharacter(char) to use as indentation per one list level. |
void |
setCharacter(char value)
Sets which character to use for indenting list levels.
|
void |
setCount(int value)
Sets how many
getCharacter() / setCharacter(char) to use as indentation per one list level. |
public int getCount()
getCharacter() / setCharacter(char) to use as indentation per one list level. The default value is 0, that means no indentation.
Examples:
Shows how to configure list indenting when saving a document to plaintext.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list with three levels of indentation.
builder.getListFormat().applyNumberDefault();
builder.writeln("Item 1");
builder.getListFormat().listIndent();
builder.writeln("Item 2");
builder.getListFormat().listIndent();
builder.write("Item 3");
// Create a "TxtSaveOptions" object, which we can pass to the document's "Save" method
// to modify how we save the document to plaintext.
TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
// Set the "Character" property to assign a character to use
// for padding that simulates list indentation in plaintext.
txtSaveOptions.getListIndentation().setCharacter(' ');
// Set the "Count" property to specify the number of times
// to place the padding character for each list indent level.
txtSaveOptions.getListIndentation().setCount(3);
doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);
String docText = getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt";
TestUtil.fileContainsString("1. Item 1\r\n" +
" a. Item 2\r\n" +
" i. Item 3", docText);
getCharacter() / setCharacter(char) to use as indentation per one list level.public void setCount(int value)
getCharacter() / setCharacter(char) to use as indentation per one list level. The default value is 0, that means no indentation.
Examples:
Shows how to configure list indenting when saving a document to plaintext.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list with three levels of indentation.
builder.getListFormat().applyNumberDefault();
builder.writeln("Item 1");
builder.getListFormat().listIndent();
builder.writeln("Item 2");
builder.getListFormat().listIndent();
builder.write("Item 3");
// Create a "TxtSaveOptions" object, which we can pass to the document's "Save" method
// to modify how we save the document to plaintext.
TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
// Set the "Character" property to assign a character to use
// for padding that simulates list indentation in plaintext.
txtSaveOptions.getListIndentation().setCharacter(' ');
// Set the "Count" property to specify the number of times
// to place the padding character for each list indent level.
txtSaveOptions.getListIndentation().setCount(3);
doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);
String docText = getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt";
TestUtil.fileContainsString("1. Item 1\r\n" +
" a. Item 2\r\n" +
" i. Item 3", docText);
value - How many getCharacter() / setCharacter(char) to use as indentation per one list level.public char getCharacter()
Examples:
Shows how to configure list indenting when saving a document to plaintext.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list with three levels of indentation.
builder.getListFormat().applyNumberDefault();
builder.writeln("Item 1");
builder.getListFormat().listIndent();
builder.writeln("Item 2");
builder.getListFormat().listIndent();
builder.write("Item 3");
// Create a "TxtSaveOptions" object, which we can pass to the document's "Save" method
// to modify how we save the document to plaintext.
TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
// Set the "Character" property to assign a character to use
// for padding that simulates list indentation in plaintext.
txtSaveOptions.getListIndentation().setCharacter(' ');
// Set the "Count" property to specify the number of times
// to place the padding character for each list indent level.
txtSaveOptions.getListIndentation().setCount(3);
doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);
String docText = getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt";
TestUtil.fileContainsString("1. Item 1\r\n" +
" a. Item 2\r\n" +
" i. Item 3", docText);
public void setCharacter(char value)
Examples:
Shows how to configure list indenting when saving a document to plaintext.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list with three levels of indentation.
builder.getListFormat().applyNumberDefault();
builder.writeln("Item 1");
builder.getListFormat().listIndent();
builder.writeln("Item 2");
builder.getListFormat().listIndent();
builder.write("Item 3");
// Create a "TxtSaveOptions" object, which we can pass to the document's "Save" method
// to modify how we save the document to plaintext.
TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
// Set the "Character" property to assign a character to use
// for padding that simulates list indentation in plaintext.
txtSaveOptions.getListIndentation().setCharacter(' ');
// Set the "Count" property to specify the number of times
// to place the padding character for each list indent level.
txtSaveOptions.getListIndentation().setCount(3);
doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);
String docText = getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt";
TestUtil.fileContainsString("1. Item 1\r\n" +
" a. Item 2\r\n" +
" i. Item 3", docText);
value - Which character to use for indenting list levels.