PlainTextDocument class

PlainTextDocument class

Allows to extract plain-text representation of the document’s content. To learn more, visit the Working with Text Document documentation article.

Constructors

NameDescription
PlainTextDocument(fileName)Creates a plain text document from a file. Automatically detects the file format.
PlainTextDocument(fileName, loadOptions)Creates a plain text document from a file. Allows to specify additional options such as an encryption password.
PlainTextDocument(stream)Creates a plain text document from a stream. 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.

Properties

NameDescription
builtInDocumentPropertiesGets PlainTextDocument.builtInDocumentProperties of the document.
customDocumentPropertiesGets PlainTextDocument.customDocumentProperties of the document.
textGets textual content of the document concatenated as a string.

Examples

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

let doc = new aw.Document(); 
let builder = new aw.DocumentBuilder(doc);
builder.writeln("Hello world!");

doc.save(base.artifactsDir + "PlainTextDocument.load.docx");

let plaintext = new aw.PlainTextDocument(base.artifactsDir + "PlainTextDocument.load.docx");

expect(plaintext.text.trim()).toEqual("Hello world!");

See Also