SaveFormat
Contents
[
Hide
]TxtSaveOptions.SaveFormat property
Specifies the format in which the document will be saved if this save options object is used. Can only be Text.
public override SaveFormat SaveFormat { get; set; }
Examples
Shows how to save a .txt document with a custom paragraph break.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Paragraph 1.");
builder.Writeln("Paragraph 2.");
builder.Write("Paragraph 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();
Assert.AreEqual(SaveFormat.Text, txtSaveOptions.SaveFormat);
// Set the "ParagraphBreak" to a custom value that we wish to put at the end of every paragraph.
txtSaveOptions.ParagraphBreak = " End of paragraph.\n\n\t";
doc.Save(ArtifactsDir + "TxtSaveOptions.ParagraphBreak.txt", txtSaveOptions);
string docText = File.ReadAllText(ArtifactsDir + "TxtSaveOptions.ParagraphBreak.txt");
Assert.AreEqual("Paragraph 1. End of paragraph.\n\n\t" +
"Paragraph 2. End of paragraph.\n\n\t" +
"Paragraph 3. End of paragraph.\n\n\t", docText);
See Also
- enum SaveFormat
- class TxtSaveOptions
- namespace Aspose.Words.Saving
- assembly Aspose.Words