May 15 2013

docx4j/pptx/xlsx online code generation

Just launched is http://webapp.docx4java.org

You should be able to see it in the menu at the top right of this website (if not, reload the web page…).

There are three things you can do with it right now:

• Explore your docx/pptx/xlsx and its representation in docx4j

• Convert  docx to PDF or XSL FO

• Merge docx files (eg cover letter plus contract) into a single docx, using Plutext’s MergeDocx. Or the same thing for pptx files, using MergePptx.

Here I want to focus on the first of these.

After you’ve uploaded your docx/pptx/xlsx, the first thing you see is like docx4j’s PartsList sample:

Here, I’ll click in the left hand column to look at the main document part, document.xml

When I do that, I see the XML:

No surprises there.

But notice the hyperlinks.  Here I’ll just click on the first w:p.

What you get back, is Java source code to create that complete structure:-

As you can see from the image above, both styles of code (as described in docx4j’s Getting Started document) are produced for you.  With a bit of luck, you can cut/paste either into your IDE (Eclipse or whatever), and just run with it!

To actually see the created object in an Office document, you’ll still need to add the created object to a part.  See Getting Started, or the cheat sheet for how to do that.

I hope this helps you to create/modify your Office documents more efficiently,with docx4j!

Do let us know what you think in the comments, or in docx4j’s forums.

2 Responses so far

  1. 1

    iknc4miles said,

    June 14, 2013 @ 7:19 am

    This is an amazing tool! I’m writing a report template out, then loading it up to your webapp, and getting the JAVA source to use with the docx4j-2.8.1 jar.

    I have one issue. On import statement “import org.docx4j.wml.CTTblLook;” cannot be resolved. Is this missing from the jar? Is it only in the latest build?

  2. 2

    Jason Harrop said,

    June 19, 2013 @ 5:14 pm

    Correct, the webapp is running current master tip, and CTTblLook was introduced into that 3 months ago:

    https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/wml/CTTblLook.java

    You can get it in a recent nightly build.

Comment RSS