public class TxtListIndentation
Example:
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);
Constructor Summary |
---|
Property Getters/Setters Summary | ||
---|---|---|
char | getCharacter() | |
void | setCharacter(charvalue) | |
Gets or sets which character to use for indenting list levels. The default value is '\0', that means there is no indentation. | ||
int | getCount() | |
void | setCount(intvalue) | |
Gets or sets how many |
public char getCharacter() / public void setCharacter(char value)
Example:
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 int getCount() / public void setCount(int value)
Example:
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);