java.lang.Objectcom.aspose.words.PlainTextDocument
public class PlainTextDocument
Example:
TxtLoadOptions loadOptions = new TxtLoadOptions();
loadOptions.setDetectNumberingWithWhitespaces(false);
PlainTextDocument plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx");
plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx", loadOptions);
Constructor Summary |
---|
PlainTextDocument(java.lang.String fileName)
Creates a plain text document from a file. Automatically detects the file format. |
PlainTextDocument(java.lang.String fileName, LoadOptions loadOptions)
Creates a plain text document from a file. Allows to specify additional options such as an encryption password. |
PlainTextDocument(java.io.InputStream stream)
Creates a plain text document from a stream. Automatically detects the file format. |
PlainTextDocument(java.io.InputStream stream, LoadOptions loadOptions)
Creates a plain text document from a stream. Allows to specify additional options such as an encryption password. |
Property Getters/Setters Summary | ||
---|---|---|
BuiltInDocumentProperties | getBuiltInDocumentProperties() | |
Gets |
||
CustomDocumentProperties | getCustomDocumentProperties() | |
Gets |
||
java.lang.String | getText() | |
Gets textual content of the document concatenated as a string. |
Constructor Detail |
---|
public PlainTextDocument(java.lang.String fileName) throws java.lang.Exception
fileName
- Name of the file to extract the text from.Example:
Show how to simply extract text from a document.TxtLoadOptions loadOptions = new TxtLoadOptions(); loadOptions.setDetectNumberingWithWhitespaces(false); PlainTextDocument plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx"); plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx", loadOptions);
public PlainTextDocument(java.lang.String fileName, LoadOptions loadOptions) throws java.lang.Exception
fileName
- Name of the file to extract the text from.loadOptions
- Additional options to use when loading a document. Can be null.Example:
Show how to simply extract text from a document.TxtLoadOptions loadOptions = new TxtLoadOptions(); loadOptions.setDetectNumberingWithWhitespaces(false); PlainTextDocument plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx"); plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx", loadOptions);
public PlainTextDocument(java.io.InputStream stream) throws java.lang.Exception
The document must be stored at the beginning of the stream.
stream
- The stream where to extract the text from.Example:
Show how to simply extract text from a stream.TxtLoadOptions loadOptions = new TxtLoadOptions(); loadOptions.setDetectNumberingWithWhitespaces(false); InputStream stream = new FileInputStream(getMyDir() + "Bookmark.docx"); PlainTextDocument plaintext = new PlainTextDocument(stream); stream.close(); stream = new FileInputStream(getMyDir() + "Bookmark.docx"); plaintext = new PlainTextDocument(stream, loadOptions);
public PlainTextDocument(java.io.InputStream stream, LoadOptions loadOptions) throws java.lang.Exception
The document must be stored at the beginning of the stream.
stream
- The stream where to extract the text from.loadOptions
- Additional options to use when loading a document. Can be null.Example:
Show how to simply extract text from a stream.TxtLoadOptions loadOptions = new TxtLoadOptions(); loadOptions.setDetectNumberingWithWhitespaces(false); InputStream stream = new FileInputStream(getMyDir() + "Bookmark.docx"); PlainTextDocument plaintext = new PlainTextDocument(stream); stream.close(); stream = new FileInputStream(getMyDir() + "Bookmark.docx"); plaintext = new PlainTextDocument(stream, loadOptions);
Property Getters/Setters Detail |
---|
getBuiltInDocumentProperties | |
public BuiltInDocumentProperties getBuiltInDocumentProperties() |
Example:
Show how to get BuiltIn properties of plain text document.PlainTextDocument plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx"); BuiltInDocumentProperties builtInDocumentProperties = plaintext.getBuiltInDocumentProperties();
getCustomDocumentProperties | |
public CustomDocumentProperties getCustomDocumentProperties() |
Example:
Show how to get custom properties of plain text document.PlainTextDocument plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx"); CustomDocumentProperties customDocumentProperties = plaintext.getCustomDocumentProperties();
getText | |
public java.lang.String getText() |
Example:
Show how to simply extract text from a document.TxtLoadOptions loadOptions = new TxtLoadOptions(); loadOptions.setDetectNumberingWithWhitespaces(false); PlainTextDocument plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx"); plaintext = new PlainTextDocument(getMyDir() + "Bookmark.docx", loadOptions);