TxtListIndentation

TxtListIndentation class

Specifies how list levels are indented when document is exporting to Text format.

public class TxtListIndentation

Constructors

Name Description
TxtListIndentation() The default constructor.

Properties

Name Description
Character { get; set; } Gets or sets which character to use for indenting list levels. The default value is ‘\0’, that means there is no indentation.
Count { get; set; } Gets or sets how many Character 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.ListFormat.ApplyNumberDefault();
builder.Writeln("Item 1");
builder.ListFormat.ListIndent();
builder.Writeln("Item 2");
builder.ListFormat.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.ListIndentation.Character = ' ';

// Set the "Count" property to specify the number of times
// to place the padding character for each list indent level.
txtSaveOptions.ListIndentation.Count = 3;

doc.Save(ArtifactsDir + "TxtSaveOptions.TxtListIndentation.txt", txtSaveOptions);

string docText = File.ReadAllText(ArtifactsDir + "TxtSaveOptions.TxtListIndentation.txt");

Assert.AreEqual("1. Item 1\r\n" +
                "   a. Item 2\r\n" +
                "      i. Item 3\r\n", docText);

See Also