DocxEditorKit library in JEditorPane/JTextPane.
The kit works with docx files. It can open docx file ad reflect the content in JEditorPane (or JTextPane). Also user can create styled content and store the content in docx format.
That's the first version which supports very basic functionality - text with attributes (font family, size, colors, effects), paragraph with attributes (align, indents, line spacing), simple images, simple tables.
In the furute I am going to extend the kit and include pagination, bullets/numberings, extended tables etc.
It uses dox4j library in background to read and write the files. The list of jars to be included in the classpath is below:
The DocxEditorKit screenshot shows how it looks:
To show docx file in JEditorPane use following code:
JEditorPane editorPane=new JEditorPane(); editorPane.setEditorKit(new DocxEditorKit()); editorPane.getEditorKit().read(new FileInputStream(pathToFile));
To save content back use
The kit is free to use and anybody can see the sources and modify it as necessary.
You can get here http://www.docx4java.org/docx4j/docx4j-2.8.1.zip all the docx4j libraries necessary for the kit.