Aspose::Words::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.

class PlainTextDocument : public System::Object

Methods

MethodDescription
get_BuiltInDocumentProperties() constGets BuiltInDocumentProperties of the document.
get_CustomDocumentProperties() constGets CustomDocumentProperties of the document.
get_Text() constGets textual content of the document concatenated as a string.
GetType() const override
Is(const System::TypeInfo&) const override
PlainTextDocument(const System::String&)Creates a plain text document from a file. Automatically detects the file format.
PlainTextDocument(const System::String&, const System::SharedPtr<Aspose::Words::Loading::LoadOptions>&)Creates a plain text document from a file. Allows to specify additional options such as an encryption password.
PlainTextDocument(const System::SharedPtr<System::IO::Stream>&)Creates a plain text document from a stream. Automatically detects the file format.
PlainTextDocument(const System::SharedPtr<System::IO::Stream>&, const System::SharedPtr<Aspose::Words::Loading::LoadOptions>&)Creates a plain text document from a stream. Allows to specify additional options such as an encryption password.
PlainTextDocument(std::istream&)
PlainTextDocument(std::istream&, const System::SharedPtr<Aspose::Words::Loading::LoadOptions>&)
static Type()

Examples

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

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
builder->Writeln(u"Hello world!");

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

auto plaintext = MakeObject<PlainTextDocument>(ArtifactsDir + u"PlainTextDocument.Load.docx");

ASSERT_EQ(u"Hello world!", plaintext->get_Text().Trim());

See Also