Dec 04 2014
- View Open XML right from within Word, and see what happens when you edit it.
- Or generate corresponding docx4j Java code, with deep links into the corresponding docx4j source code and Open XML spec.
Regular users of docx4j will be aware of our webapp, which amongst other things, generates docx4j Java code for the specified Open XML in your sample docx/pptx/xlsx.
The webapp is useful, but it has a few draw backs:
- you have to upload your docx/pptx/xlsx, which takes time
- if your docx/pptx/xlsx contains sensitive data, you probably want to remove that first
- the webapp might be down
To address these issues, we’re now offering the code gen functionality as a Word AddIn.
If you install the Word AddIn, this means you can now generate code without your docx leaving your computer.
This is all feasible because docx4j can run as a DLL in a .NET project, thanks to IKVM!
Where to get it
You can download the installer. After you complete the landing form (using your corporate email address, not gmail etc), you’ll be sent a download link.
After a successful installation, after restarting Word, you should see a “Docx4j” menu, containing:
To generate code, first press the “Load Helper” button.
You’ll see the following form:
Its inviting you to start a local web server which will run the same code as the existing webapp. Just choose a port you aren’t already using. If for some reason you want to browse using Internet Explorer (as opposed to your default browser), check the box.
It’ll take a little while to start the server; you’ll see a dialog when its started.
Now you can generate code. To do so, select something in your docx, then click the “Generate Code” button.
After a while, a window will open in your web browser, and you’ll see:
That’s the view of the docx package, which will be familiar if you’ve used the webapp. For how to generate code from here, see our earlier post.
Code generating is done on your computer. (But note, the links on that page to docx4j source code and the OpenXML spec are external links)
What about the “Edit OpenXML” button?
If you select something in your docx, then click that button, after a while (maybe 30 secs the first time!), you’ll see the corresponding XML in an editor window:
You can go ahead and edit it, then click the “Apply” button.
If Word likes your XML, you’ll see your changes on the document surface. Ctrl Z should work for undo.
So there are 2 ways to see the underlying XML
The first way we described uses your web browser; the second is a Windows Form.
These two views have different features; maybe a later release will unify them?
What about pptx, xlsx?
There’s no reason in principle we couldn’t make a similar AddIn for Powerpoint and Excel. In fact, we plan to make these, once any teething issues have been ironed out in the WordAddIn.
In the meantime, for pptx and xlsx, you can continue to use the webapp.
Help, Suggestions and other Discussion
If you are a Plutext customer experiencing an issue, please email firstname.lastname@example.org
Otherwise, please check the Docx4jHelper AddIn forum.
We’ve got some ideas for where the AddIn goes from here, but we’d love to hear yours.