Package org.apache.poi.hwpf.converter
Class WordToHtmlConverter
java.lang.Object
org.apache.poi.hwpf.converter.AbstractWordConverter
org.apache.poi.hwpf.converter.WordToHtmlConverter
Converts Word files (95-2007) into HTML files.
This implementation doesn't create images or links to them. This can be
changed by overriding AbstractWordConverter.processImage(Element, boolean, Picture)
method.
-
Field Summary
Fields inherited from class org.apache.poi.hwpf.converter.AbstractWordConverter
UNICODECHAR_NO_BREAK_SPACE, UNICODECHAR_NONBREAKING_HYPHEN, UNICODECHAR_ZERO_WIDTH_SPACE -
Constructor Summary
ConstructorsConstructorDescriptionWordToHtmlConverter(HtmlDocumentFacade htmlDocumentFacade) WordToHtmlConverter(Document document) Creates new instance ofWordToHtmlConverter. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSpecial actions that need to be called after processing complete, like updating stylesheets or building document notes list.static voidJava main() interface to interact withWordToHtmlConverterprotected voidoutputCharacters(Element pElement, CharacterRun characterRun, String text) protected voidprocessBookmarks(HWPFDocumentCore wordDocument, Element currentBlock, Range range, int currentTableLevel, List<Bookmark> rangeBookmarks) Wrap range into bookmark(s) and process it.protected voidprocessDocumentInformation(SummaryInformation summaryInformation) voidprocessDocumentPart(HWPFDocumentCore wordDocument, Range range) protected voidprocessDrawnObject(HWPFDocument doc, CharacterRun characterRun, OfficeDrawing officeDrawing, String path, Element block) protected voidprocessDropDownList(Element block, CharacterRun characterRun, String[] values, int defaultIndex) protected voidprocessEndnoteAutonumbered(HWPFDocument wordDocument, int noteIndex, Element block, Range endnoteTextRange) protected voidprocessFootnoteAutonumbered(HWPFDocument wordDocument, int noteIndex, Element block, Range footnoteTextRange) protected voidprocessHyperlink(HWPFDocumentCore wordDocument, Element currentBlock, Range textRange, int currentTableLevel, String hyperlink) protected voidprocessImage(Element currentBlock, boolean inlined, Picture picture, String imageSourcePath) protected voidprocessImageWithoutPicturesManager(Element currentBlock, boolean inlined, Picture picture) protected voidprocessLineBreak(Element block, CharacterRun characterRun) protected voidprocessNoteAutonumbered(HWPFDocument doc, String type, int noteIndex, Element block, Range noteTextRange) protected voidprocessPageBreak(HWPFDocumentCore wordDocument, Element flow) protected voidprocessPageref(HWPFDocumentCore hwpfDocument, Element currentBlock, Range textRange, int currentTableLevel, String pageref) protected voidprocessParagraph(HWPFDocumentCore hwpfDocument, Element parentElement, int currentTableLevel, Paragraph paragraph, String bulletText) protected voidprocessSection(HWPFDocumentCore wordDocument, Section section, int sectionCounter) protected voidprocessSingleSection(HWPFDocumentCore wordDocument, Section section) protected voidprocessTable(HWPFDocumentCore hwpfDocument, Element flow, Table table) Methods inherited from class org.apache.poi.hwpf.converter.AbstractWordConverter
getCharacterRunTriplet, getFontReplacer, getNumberColumnsSpanned, getNumberRowsSpanned, getPicturesManager, processCharacters, processDeadField, processDocument, processDrawnObject, processField, processImage, processNoteAnchor, processOle2, processParagraphes, processSymbol, setFontReplacer, setPicturesManager, tryDeadField
-
Constructor Details
-
WordToHtmlConverter
Creates new instance ofWordToHtmlConverter. Can be used for output severalHWPFDocuments into single HTML document.- Parameters:
document- XML DOM Document used as HTML document
-
WordToHtmlConverter
-
-
Method Details
-
main
public static void main(String[] args) throws IOException, ParserConfigurationException, TransformerException Java main() interface to interact withWordToHtmlConverterUsage: WordToHtmlConverter infile outfile
Where infile is an input .doc file ( Word 95-2007) which will be rendered as HTML into outfile
-
afterProcess
protected void afterProcess()Description copied from class:AbstractWordConverterSpecial actions that need to be called after processing complete, like updating stylesheets or building document notes list. Usually they are called once, but it's okay to call them several times.- Overrides:
afterProcessin classAbstractWordConverter
-
getDocument
- Specified by:
getDocumentin classAbstractWordConverter
-
outputCharacters
- Specified by:
outputCharactersin classAbstractWordConverter
-
processBookmarks
protected void processBookmarks(HWPFDocumentCore wordDocument, Element currentBlock, Range range, int currentTableLevel, List<Bookmark> rangeBookmarks) Description copied from class:AbstractWordConverterWrap range into bookmark(s) and process it. All bookmarks have starts equal to range start and ends equal to range end. Usually it's only one bookmark.- Specified by:
processBookmarksin classAbstractWordConverter
-
processDocumentInformation
- Specified by:
processDocumentInformationin classAbstractWordConverter
-
processDocumentPart
- Overrides:
processDocumentPartin classAbstractWordConverter
-
processDropDownList
protected void processDropDownList(Element block, CharacterRun characterRun, String[] values, int defaultIndex) - Overrides:
processDropDownListin classAbstractWordConverter
-
processDrawnObject
protected void processDrawnObject(HWPFDocument doc, CharacterRun characterRun, OfficeDrawing officeDrawing, String path, Element block) - Specified by:
processDrawnObjectin classAbstractWordConverter
-
processEndnoteAutonumbered
protected void processEndnoteAutonumbered(HWPFDocument wordDocument, int noteIndex, Element block, Range endnoteTextRange) - Specified by:
processEndnoteAutonumberedin classAbstractWordConverter
-
processFootnoteAutonumbered
protected void processFootnoteAutonumbered(HWPFDocument wordDocument, int noteIndex, Element block, Range footnoteTextRange) - Specified by:
processFootnoteAutonumberedin classAbstractWordConverter
-
processHyperlink
protected void processHyperlink(HWPFDocumentCore wordDocument, Element currentBlock, Range textRange, int currentTableLevel, String hyperlink) - Specified by:
processHyperlinkin classAbstractWordConverter
-
processImage
protected void processImage(Element currentBlock, boolean inlined, Picture picture, String imageSourcePath) - Specified by:
processImagein classAbstractWordConverter
-
processImageWithoutPicturesManager
protected void processImageWithoutPicturesManager(Element currentBlock, boolean inlined, Picture picture) - Specified by:
processImageWithoutPicturesManagerin classAbstractWordConverter
-
processLineBreak
- Specified by:
processLineBreakin classAbstractWordConverter
-
processNoteAutonumbered
protected void processNoteAutonumbered(HWPFDocument doc, String type, int noteIndex, Element block, Range noteTextRange) -
processPageBreak
- Specified by:
processPageBreakin classAbstractWordConverter
-
processPageref
protected void processPageref(HWPFDocumentCore hwpfDocument, Element currentBlock, Range textRange, int currentTableLevel, String pageref) - Specified by:
processPagerefin classAbstractWordConverter
-
processParagraph
protected void processParagraph(HWPFDocumentCore hwpfDocument, Element parentElement, int currentTableLevel, Paragraph paragraph, String bulletText) - Specified by:
processParagraphin classAbstractWordConverter
-
processSection
- Specified by:
processSectionin classAbstractWordConverter
-
processSingleSection
- Overrides:
processSingleSectionin classAbstractWordConverter
-
processTable
- Specified by:
processTablein classAbstractWordConverter
-