public class DocumentConverter extends Object
| Constructor and Description |
|---|
DocumentConverter() |
| Modifier and Type | Method and Description |
|---|---|
DocumentConverter |
addStyleMap(String styleMap)
Add a style map to specify the mapping of Word styles to HTML.
|
Result<String> |
convertToHtml(File file)
Converts
file into an HTML string. |
Result<String> |
convertToHtml(InputStream stream)
Converts
stream into an HTML string. |
DocumentConverter |
disableDefaultStyleMap()
By default, any added style maps are combined with the default style map.
|
DocumentConverter |
disableEmbeddedStyleMap()
By default, if the document contains an embedded style map, then it is combined with the default style map.
|
Result<String> |
extractRawText(File file)
Extract the raw text of the document.
|
Result<String> |
extractRawText(InputStream stream)
Extract the raw text of the document.
|
DocumentConverter |
idPrefix(String idPrefix)
A string to prepend to any generated IDs,
such as those used by bookmarks, footnotes and endnotes.
|
DocumentConverter |
imageConverter(ImageConverter.ImgElement imageConverter)
By default, images are converted to
<img> elements with the source included inline in the src attribute. |
DocumentConverter |
preserveEmptyParagraphs()
By default, empty paragraphs are ignored.
|
public DocumentConverter idPrefix(String idPrefix)
public DocumentConverter preserveEmptyParagraphs()
public DocumentConverter addStyleMap(String styleMap)
public DocumentConverter disableDefaultStyleMap()
public DocumentConverter disableEmbeddedStyleMap()
public DocumentConverter imageConverter(ImageConverter.ImgElement imageConverter)
<img> elements with the source included inline in the src attribute.
Call this to change how images are converted.public Result<String> convertToHtml(InputStream stream) throws IOException
stream into an HTML string.
Note that using this method instead of convertToHtml(File file)
means that relative paths to other files, such as images, cannot be resolved.IOExceptionpublic Result<String> convertToHtml(File file) throws IOException
file into an HTML string.IOExceptionpublic Result<String> extractRawText(InputStream stream) throws IOException
IOExceptionpublic Result<String> extractRawText(File file) throws IOException
IOExceptionCopyright © 2018. All rights reserved.