PlainTextDocument

PlainTextDocument class

Allows to extract plain-text representation of the document’s content.

To learn more, visit the Working with Text Document documentation article.

public class PlainTextDocument

Constructors

NameDescription
PlainTextDocument(Stream)Creates a plain text document from a stream. Automatically detects the file format.
PlainTextDocument(string)Creates a plain text document from a file. Automatically detects the file format.
PlainTextDocument(Stream, LoadOptions)Creates a plain text document from a stream. Allows to specify additional options such as an encryption password.
PlainTextDocument(string, LoadOptions)Creates a plain text document from a file. Allows to specify additional options such as an encryption password.

Properties

NameDescription
BuiltInDocumentProperties { get; }Gets BuiltInDocumentProperties of the document.
CustomDocumentProperties { get; }Gets CustomDocumentProperties of the document.
Text { get; }Gets textual content of the document concatenated as a string.

Examples

Shows how to load the contents of a Microsoft Word document in plaintext.

Document doc = new Document(); 
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello world!");

doc.Save(ArtifactsDir + "PlainTextDocument.Load.docx");

PlainTextDocument plaintext = new PlainTextDocument(ArtifactsDir + "PlainTextDocument.Load.docx");

Assert.AreEqual("Hello world!", plaintext.Text.Trim());

See Also