com.aspose.words

Class TxtListIndentation

  • 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 converting 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");

// Microsoft Word list objects get lost when converting to plaintext
// We can create a custom representation for list indentation using pure plaintext with a SaveOptions object
// In this case, each list item will be left-padded by 3 space characters times its list indent level
TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
txtSaveOptions.getListIndentation().setCount(3);
txtSaveOptions.getListIndentation().setCharacter(' ');

doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);

Constructor Summary
 
Property Getters/Setters Summary
chargetCharacter()
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.
intgetCount()
void
setCount(intvalue)
           Gets or sets how many Character to use as indentation per one list level. The default value is 0, that means no indentation.
 

    • Constructor Detail

      • 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 converting 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");
        
        // Microsoft Word list objects get lost when converting to plaintext
        // We can create a custom representation for list indentation using pure plaintext with a SaveOptions object
        // In this case, each list item will be left-padded by 3 space characters times its list indent level
        TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
        txtSaveOptions.getListIndentation().setCount(3);
        txtSaveOptions.getListIndentation().setCharacter(' ');
        
        doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);
      • 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 converting 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");
        
        // Microsoft Word list objects get lost when converting to plaintext
        // We can create a custom representation for list indentation using pure plaintext with a SaveOptions object
        // In this case, each list item will be left-padded by 3 space characters times its list indent level
        TxtSaveOptions txtSaveOptions = new TxtSaveOptions();
        txtSaveOptions.getListIndentation().setCount(3);
        txtSaveOptions.getListIndentation().setCharacter(' ');
        
        doc.save(getArtifactsDir() + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);