PlainTextDocument constructor

PlainTextDocument(fileName)

Creates a plain text document from a file. Automatically detects the file format.

PlainTextDocument(fileName: string)
ParameterTypeDescription
fileNamestringName of the file to extract the text from.

Exceptions

exceptioncondition
RuntimeError (Proxy error(UnsupportedFileFormatException))The document format is not recognized or not supported.
RuntimeError (Proxy error(FileCorruptedException))The document appears to be corrupted and cannot be loaded.
RuntimeError (Proxy error(Exception))There is a problem with the document and it should be reported to Aspose.Words developers.
RuntimeError (Proxy error(IOException))There is an input/output exception.
RuntimeError (Proxy error(IncorrectPasswordException))The document is encrypted and requires a password to open, but you supplied an incorrect password.
RuntimeError (Proxy error(ArgumentException))The name of the file cannot be null or empty string.

PlainTextDocument(fileName, loadOptions)

Creates a plain text document from a file. Allows to specify additional options such as an encryption password.

PlainTextDocument(fileName: string, loadOptions: Aspose.Words.Loading.LoadOptions)
ParameterTypeDescription
fileNamestringName of the file to extract the text from.
loadOptionsLoadOptionsAdditional options to use when loading a document. Can be null.

Remarks

Exceptions

exceptioncondition
RuntimeError (Proxy error(UnsupportedFileFormatException))The document format is not recognized or not supported.
RuntimeError (Proxy error(FileCorruptedException))The document appears to be corrupted and cannot be loaded.
RuntimeError (Proxy error(Exception))There is a problem with the document and it should be reported to Aspose.Words developers.
RuntimeError (Proxy error(IOException))There is an input/output exception.
RuntimeError (Proxy error(IncorrectPasswordException))The document is encrypted and requires a password to open, but you supplied an incorrect password.
RuntimeError (Proxy error(ArgumentException))The name of the file cannot be null or empty string.

PlainTextDocument(stream)

Creates a plain text document from a stream. Automatically detects the file format.

PlainTextDocument(stream: Buffer)
ParameterTypeDescription
streamBufferThe stream where to extract the text from.

Remarks

The document must be stored at the beginning of the stream.

Exceptions

exceptioncondition
RuntimeError (Proxy error(UnsupportedFileFormatException))The document format is not recognized or not supported.
RuntimeError (Proxy error(FileCorruptedException))The document appears to be corrupted and cannot be loaded.
RuntimeError (Proxy error(Exception))There is a problem with the document and it should be reported to Aspose.Words developers.
RuntimeError (Proxy error(IOException))There is an input/output exception.
RuntimeError (Proxy error(IncorrectPasswordException))The document is encrypted and requires a password to open, but you supplied an incorrect password.
RuntimeError (Proxy error(ArgumentNullException))The stream cannot be null.
RuntimeError (Proxy error(NotSupportedException))The stream does not support reading or seeking.
RuntimeError (Proxy error(ObjectDisposedException))The stream is a disposed object.

PlainTextDocument(stream, loadOptions)

Creates a plain text document from a stream. Allows to specify additional options such as an encryption password.

PlainTextDocument(stream: Buffer, loadOptions: Aspose.Words.Loading.LoadOptions)
ParameterTypeDescription
streamBufferThe stream where to extract the text from.
loadOptionsLoadOptionsAdditional options to use when loading a document. Can be null.

Remarks

The document must be stored at the beginning of the stream.

Exceptions

exceptioncondition
RuntimeError (Proxy error(UnsupportedFileFormatException))The document format is not recognized or not supported.
RuntimeError (Proxy error(FileCorruptedException))The document appears to be corrupted and cannot be loaded.
RuntimeError (Proxy error(Exception))There is a problem with the document and it should be reported to Aspose.Words developers.
RuntimeError (Proxy error(IOException))There is an input/output exception.
RuntimeError (Proxy error(IncorrectPasswordException))The document is encrypted and requires a password to open, but you supplied an incorrect password.
RuntimeError (Proxy error(ArgumentNullException))The stream cannot be null.
RuntimeError (Proxy error(NotSupportedException))The stream does not support reading or seeking.
RuntimeError (Proxy error(ObjectDisposedException))The stream is a disposed object.

See Also