Home » Apache POI Microsoft Word

Apache POI Microsoft Word

by Online Tutorials Library

Apache POI Microsoft Word

Apache POI provides pure Java API for handling Microsoft Office word. We can create new word document, write and read data from Java program.

HWPF (Horrible Word Processor Format) is used to read and write .doc extension files of MS-Word.

XWPF (XML Word Processor Format) is used to read and write .docx extension files of MS-Word.

We can use either both of the above to create new document, get the paragraphs, pictures, tables, sections, headers etc.

Following are the Microsoft Office word commonly used classes.

Class Description
HWPFDocument It is used to handle .doc extension file.
XWPFDocument It is used to create MS-Word Document having .docx file format and located into org.apache.poi.xwpf.usermodel package.
XWPFParagraph It is used to create paragraph in a word document and located into org.apache.poi.xwpf.usermodel package.
XWPFRun It is used to add a region of text to the paragraph and located into org.apache.poi.xwpf.usermodel package.
XWPFStyle It is used to add different styles to the object elements in a word document and located into org.apache.poi.xwpf.usermodel package.
XWPFTable It is used to add table into a word document and located into org.apache.poi.xwpf.usermodel package.
XWPFWordExtractor It is a basic parser class used to extract the simple text from a Word document.

You may also like