Count
Contents
[
Hide
]TxtListIndentation.Count property
Gets or sets how many Character
to use as indentation per one list level. The default value is 0, that means no indentation.
public int Count { get; set; }
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");
string newLine= Environment.NewLine;
Assert.AreEqual($"1. Item 1{newLine}" +
$" a. Item 2{newLine}" +
$" i. Item 3{newLine}", docText);
See Also
- class TxtListIndentation
- namespace Aspose.Words.Saving
- assembly Aspose.Words