TxtListIndentation
Inheritance: java.lang.Object
public class TxtListIndentation
Specifies how list levels are indented when document is exporting to 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);
Methods
Method | Description |
---|---|
getCharacter() | Gets which character to use for indenting list levels. |
getCount() | Gets how many getCharacter() / setCharacter(char) to use as indentation per one list level. |
setCharacter(char value) | Sets which character to use for indenting list levels. |
setCount(int value) | Sets how many getCharacter() / setCharacter(char) to use as indentation per one list level. |
getCharacter()
public char getCharacter()
Gets which character to use for indenting list levels. The default value is ‘\0’, that means there is 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);
Returns: char - Which character to use for indenting list levels.
getCount()
public int getCount()
Gets how many 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);
Returns: int - How many getCharacter() / setCharacter(char) to use as indentation per one list level.
setCharacter(char value)
public void setCharacter(char value)
Sets which character to use for indenting list levels. The default value is ‘\0’, that means there is 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);
Parameters:
Parameter | Type | Description |
---|---|---|
value | char | Which character to use for indenting list levels. |
setCount(int value)
public void setCount(int value)
Sets how many 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);
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | How many getCharacter() / setCharacter(char) to use as indentation per one list level. |