SimplifyListLabels
Contents
[
Hide
]TxtSaveOptions.SimplifyListLabels property
Specifies whether the program should simplify list labels in case of complex label formatting not being adequately represented by plain text.
If set to true, numbered list labels are written in simple numeric format and itemized list labels as simple ASCII characters. The default value is false.
public bool SimplifyListLabels { get; set; }
Examples
Shows how to change the appearance of lists when saving a document to plaintext.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Create a bulleted list with five levels of indentation.
builder.ListFormat.ApplyBulletDefault();
builder.Writeln("Item 1");
builder.ListFormat.ListIndent();
builder.Writeln("Item 2");
builder.ListFormat.ListIndent();
builder.Writeln("Item 3");
builder.ListFormat.ListIndent();
builder.Writeln("Item 4");
builder.ListFormat.ListIndent();
builder.Write("Item 5");
// 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 "SimplifyListLabels" property to "true" to convert some list
// symbols into simpler ASCII characters, such as '*', 'o', '+', '>', etc.
// Set the "SimplifyListLabels" property to "false" to preserve as many original list symbols as possible.
txtSaveOptions.SimplifyListLabels = simplifyListLabels;
doc.Save(ArtifactsDir + "TxtSaveOptions.SimplifyListLabels.txt", txtSaveOptions);
string docText = File.ReadAllText(ArtifactsDir + "TxtSaveOptions.SimplifyListLabels.txt");
string newLine = Environment.NewLine;
if (simplifyListLabels)
Assert.That(docText, Is.EqualTo($"* Item 1{newLine}" +
$" > Item 2{newLine}" +
$" + Item 3{newLine}" +
$" - Item 4{newLine}" +
$" o Item 5{newLine}"));
else
Assert.That(docText, Is.EqualTo($"· Item 1{newLine}" +
$"o Item 2{newLine}" +
$"§ Item 3{newLine}" +
$"· Item 4{newLine}" +
$"o Item 5{newLine}"));
See Also
- class TxtSaveOptions
- namespace Aspose.Words.Saving
- assembly Aspose.Words