text property

PlainTextDocument.text property

Gets textual content of the document concatenated as a string.

@property
def text(self) -> str:
    ...

Examples

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

doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.writeln('Hello world!')
doc.save(file_name=ARTIFACTS_DIR + 'PlainTextDocument.Load.docx')
plaintext = aw.PlainTextDocument(file_name=ARTIFACTS_DIR + 'PlainTextDocument.Load.docx')
self.assertEqual('Hello world!', plaintext.text.strip())

See Also