java.lang.Object
com.aspose.words.TxtListIndentation
public class TxtListIndentation
- extends java.lang.Object
Specifies how list levels are indented when document is exporting to SaveFormat.TEXT format.
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);
Property Getters/Setters Summary |
char | getCharacter() | |
void | setCharacter(char value) | |
|
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(int value) | |
|
Gets or sets how many Character to use as indentation per one list level.
The default value is 0, that means no indentation.
|
TxtListIndentation
public TxtListIndentation()
-
Property Getters/Setters Detail |
getCharacter/setCharacter | |
public char getCharacter() / public void setCharacter(char value)
|
-
Gets or sets which character to use for indenting list levels.
The default value is '\0', that means there is no indentation.
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);
getCount/setCount | |
public int getCount() / public void setCount(int value)
|
-
Gets or sets how many Character to use as indentation per one list level.
The default value is 0, that means no indentation.
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);
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.