<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>docx4java aka docx4j - OpenXML office documents in Java &#187; jaxb</title>
	<atom:link href="http://www.docx4java.org/blog/category/jaxb/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.docx4java.org/blog</link>
	<description>docx4java aka docx4j - OpenXML office documents in Java</description>
	<lastBuildDate>Sat, 29 Oct 2011 03:57:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>docx4j 2.7.0 released</title>
		<link>http://www.docx4java.org/blog/2011/07/docx4j-2-7-0-released/</link>
		<comments>http://www.docx4java.org/blog/2011/07/docx4j-2-7-0-released/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 07:32:50 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Microsoft Word]]></category>
		<category><![CDATA[OOXML]]></category>
		<category><![CDATA[OpenXML]]></category>
		<category><![CDATA[docx]]></category>
		<category><![CDATA[docx4j]]></category>
		<category><![CDATA[jaxb]]></category>
		<category><![CDATA[pptx4j]]></category>
		<category><![CDATA[xlsx4j]]></category>

		<guid isPermaLink="false">http://dev.plutext.org/blog/?p=130</guid>
		<description><![CDATA[I&#8217;m pleased to announce the release today of docx4j 2.7.0. What is docx4j? docx4j is an open source (Apache v2) library for creating, editing, and saving OpenXML &#8220;packages&#8221;, including docx, pptx, and xslx.  it is similar to Microsoft&#8217;s OpenXML SDK, but for Java rather than .NET.   It uses JAXB to create the Java objects [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the release today of docx4j 2.7.0.</p>
<p><strong>What is docx4j?</strong></p>
<p>docx4j is an open source (Apache v2) library for creating, editing, and saving OpenXML &#8220;packages&#8221;, including docx, pptx, and xslx.  it is similar to Microsoft&#8217;s OpenXML SDK, but for Java rather than .NET.   It uses JAXB to create the Java objects out of the OpenXML parts.</p>
<p>Notable features for docx include export as HTML or PDF, and CustomXML databinding for document generation (including our <a href="http://www.opendope.org/">OpenDoPE</a> convention support for processing repeats and conditions).</p>
<p>The docx4j project started in October 2007.</p>
<p><strong>What&#8217;s new?</strong></p>
<p>This is mainly a maintenance release; things of note include:</p>
<ul>
<li>Improvements to Maven build</li>
<li>ContentAccessor interface</li>
<li>AlteredParts: identify parts in this pkg which are new or altered; Patcher<br />
which adds new or altered parts.</li>
<li>Support for .glox SmartArt package (/src/glox/)</li>
<li>JAXB RI 2.2.3 compatibilty</li>
<li>OpenDoPE support improvements</li>
</ul>
<p><strong>Where do you get it?</strong></p>
<p><strong>Binaries:</strong> You can download a <a href="http://dev.plutext.org/docx4j/docx4j-2.7.0.jar">jar alone</a> or a <a href="http://dev.plutext.org/docx4j/docx4j-2.7.0.tar.gz">tar.gz with all deps</a> or <a href="http://dev.plutext.org/docx4j/docx4j-2.7.0/">pick and choose</a>.</p>
<p><strong>Source:</strong> Checkout the source from <a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j">SVN</a> (use the pom.xml file to satisfy the dependencies eg with m2eclipse, or download them from one of the links above)</p>
<p><strong>Maven:</strong> Please see forum for details (since XML doesn&#8217;t paste nicely here right now).</p>
<p><strong>Dependency changes</strong></p>
<p>Antlr is now required for OpenDoPE processing; this gives us better XPath processing.  The required jars are:</p>
<ul>
<li><a href="http://dev.plutext.org/docx4j/docx4j-2.7.0/antlr-2.7.7.jar">antrl-2.7.7</a></li>
<li><a href="http://dev.plutext.org/docx4j/docx4j-2.7.0/antlr-runtime-3.3.jar">antrl-runtime-3.3</a></li>
<li><a href="http://dev.plutext.org/docx4j/docx4j-2.7.0/stringtemplate-3.2.1.jar">stringtemplate-3.2.1</a></li>
</ul>
<p><strong>Getting Started</strong></p>
<p>See the <a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j/docs/">&#8220;Getting Started&#8221; guide</a>.</p>
<p><strong>Thanks to our contributors</strong></p>
<p>A number of contributions have made this release what it is; thanks very much to those who contributed.</p>
<p>Contributors to this release and a more complete list of changes may be found in <a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j/README.txt">README.txt</a></p>
<p><strong>A request to docx4j users</strong></p>
<p>If you are happily using docx4j, it would be great if you could reply to this post with some words of recommendation for others who might be wondering whether docx4j is a good choice.  I know there are thousands of you out there <img src='http://www.docx4java.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Some users have been kind enough to make such statements already; these may be found on the <a href="http://dev.plutext.org/trac/docx4j">trac homepage</a>.</p>
<p>Of course, there are a number of other ways you can contribute back.  Please consider doing so, especially if you think you might find yourself looking for support from volunteers in the docx4j forums.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.docx4java.org/blog/2011/07/docx4j-2-7-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>docx4j v2.6.0 released</title>
		<link>http://www.docx4java.org/blog/2010/11/docx4j-v2-6-0-released/</link>
		<comments>http://www.docx4java.org/blog/2010/11/docx4j-v2-6-0-released/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 06:23:39 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[OpenXML]]></category>
		<category><![CDATA[docx4j]]></category>
		<category><![CDATA[jaxb]]></category>

		<guid isPermaLink="false">http://dev.plutext.org/blog/?p=113</guid>
		<description><![CDATA[I published docx4j 2.6.0 yesterday. For details, see the forum. This post introduces TraversalUtil, which makes it easier for you to find and change the bits of a docx you want to manipulate. If you are working with an existing docx, you often need to get a particular bit of the document, and change it [...]]]></description>
			<content:encoded><![CDATA[<p>I published docx4j 2.6.0 yesterday.</p>
<p>For details, see the forum.  This post introduces TraversalUtil, which makes it easier for you to find and change the bits of a docx you want to manipulate.</p>
<p>If you are working with an existing docx, you often need to get a particular bit of the document, and change it somehow.</p>
<p>If you know you want to change the 6th paragraph, say, that&#8217;s easy.</p>
<p>But if you want to find all occurrences of some item, which could occur at various different levels of the hierarchy (for example, paragraphs can appear not just in the document body, but also within table cells, and in content controls)?</p>
<p>docx4j offers a couple of different tools to make this easy.</p>
<h2>XPath</h2>
<p>XPath is a succinct way to select the things you need to change.</p>
<p>Happily, from docx4j 2.<strong>5</strong>.0, you can do use XPath to select JAXB nodes:</p>
<pre class="brush: java;">MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();

String xpath = &quot;//w:p&quot;;

List&lt;Object&gt; list = documentPart.getJAXBNodesViaXPath(xpath, &lt;strong&gt;false&lt;/strong&gt;); </pre>
<p>These JAXB nodes are live, in the sense that if you change them, your document changes.</p>
<p>There is a limitation however: the xpath expressions are evaluated against the XML document as it was when first opened in docx4j.  You can update the associated XML document once only, by passing true into getJAXBNodesViaXPath. Updating it again(with current JAXB 2.1.x or 2.2.x) will cause an error.</p>
<p>To workaround this bug in JAXB, you can marshall it, and then unmarshall the result using either:</p>
<pre class="brush: java;">
    public org.docx4j.wml.Document unmarshal( java.io.InputStream is ) 

    public org.docx4j.wml.Document unmarshal(org.w3c.dom.Element el)
</pre>
<p>Both of those will re-create the binder.</p>
<p>Not the most efficient, so consider voting for <a href="https://jaxb.dev.java.net/issues/show_bug.cgi?id=459">JAXB bug 459</a> </p>
<p>But now we have an alternative&#8230;</p>
<h2>TraversalUtil</h2>
<p>New to docx4j 2.6.0 is a class TraversalUtil, which is a general approach for traversing the JAXB object tree in the main document part (though it can also be applied to headers, footers etc).</p>
<p>For example, to get a list of hyperlinks, you can do something like:</p>
<pre class="brush: java;">
PHyperlinkFinder finder= new PHyperlinkFinder();
new TraversalUtil(paragraphs, finder);

static class PHyperlinkFinder extends CallbackImpl {

        List&lt;P.Hyperlink&gt; links = new ArrayList&lt;P.Hyperlink&gt;();  

        @Override
		public List&lt;Object&gt; apply(Object o) {

			if (o instanceof P.Hyperlink)
				links.add((P.Hyperlink)o);

			return null;
		}
	}
</pre>
<p>This approach is used extensively in the MergeDocx extension I discussed in my previous post.  It is now also the basis of the OpenMainDocumentAndTraverse sample, so see that for another example of how to use it.</p>
<p>The example above simply finds relevant bits of the docx; you could also modify the objects encountered if you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.docx4java.org/blog/2010/11/docx4j-v2-6-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>docx4j v2.3.0 released</title>
		<link>http://www.docx4java.org/blog/2010/02/docx4j-v2-3-0-released/</link>
		<comments>http://www.docx4java.org/blog/2010/02/docx4j-v2-3-0-released/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 00:52:12 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Microsoft Word]]></category>
		<category><![CDATA[OpenXML]]></category>
		<category><![CDATA[docx]]></category>
		<category><![CDATA[docx4j]]></category>
		<category><![CDATA[jaxb]]></category>

		<guid isPermaLink="false">http://dev.plutext.org/blog/?p=81</guid>
		<description><![CDATA[I&#8217;m pleased to announce the release of docx4j v2.3.0 docx4j is an open source (Apache license) project which facilitates the manipulation of Microsoft OpenXML docx (and now pptx) documents in Java, using JAXB.The main features of this release are support for pptx files, and improvements to HTML export (via NG2), and PDF export (via XSL FO). For further details, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the release of docx4j <span style="font-weight: bold; padding: 0px; margin: 0px;">v2.3.0</span></p>
<p>docx4j is an open source (Apache license) project which facilitates the manipulation of Microsoft OpenXML docx (and now pptx) documents in Java, using JAXB.<br style="padding: 0px; margin: 0px;" /><br style="padding: 0px; margin: 0px;" />The main features of this release are support for <span style="font-weight: bold; padding: 0px; margin: 0px;">pptx </span>files, and improvements to <span style="font-weight: bold; padding: 0px; margin: 0px;">HTML export (via NG2)</span>, and <span style="font-weight: bold; padding: 0px; margin: 0px;">PDF export (via XSL FO)</span>.</p>
<p>For further details, please see the <a href="http://dev.plutext.org/forums/viewforum.php?f=6">release announcement</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.docx4java.org/blog/2010/02/docx4j-v2-3-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>docx4j v2.0 released</title>
		<link>http://www.docx4java.org/blog/2008/07/docx4j-v20-released/</link>
		<comments>http://www.docx4java.org/blog/2008/07/docx4j-v20-released/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 14:11:55 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[docx]]></category>
		<category><![CDATA[docx4j]]></category>
		<category><![CDATA[jaxb]]></category>

		<guid isPermaLink="false">http://dev.plutext.org/blog/?p=41</guid>
		<description><![CDATA[We&#8217;re pleased to announce that we&#8217;ve released v2.0 of docx4j. docx4j is an open source Java library for manipulating OpenXML WordprocessingML documents, released under the Apache software licence. docx is the default file format in Word 2007 in Microsoft Office 2007. docx4j supports the following: Open existing docx (from filesystem, SMB/CIFS, WebDAV using VFS) Create [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re pleased to announce that we&#8217;ve released v2.0 of docx4j.</p>
<p>docx4j is an open source Java library for manipulating OpenXML WordprocessingML documents, released under the Apache software licence. docx is the default file format in Word 2007 in Microsoft Office 2007.</p>
<p>docx4j supports the following:</p>
<ul>
<li>Open existing docx (from filesystem, SMB/CIFS, WebDAV using VFS)</li>
<li>Create new docx (just one line of code)</li>
<li>Programmatically manipulate the docx document (of course), including tables, images</li>
<li> Import a binary doc (proof of concept)</li>
<li> Import/export Word 2007&#8242;s xmlPackage (pkg) format</li>
<li> Save docx to filesystem as a docx (ie zipped), or to JCR (unzipped)</li>
<li> Apply transforms, including common filters</li>
<li> Export as HTML or PDF</li>
<li> Diff/compare paragraphs or sdt (content controls), outputting OpenXML with changes marked up</li>
<li> Font support (font substitution, and use of any fonts embedded in the document)</li>
<li> Use the power of JAXB to do other cool stuff</li>
</ul>
<p>Get it from <a href="/docx4j/">here</a>.</p>
<p>What is it about this release that warrants being labeled v2.0?</p>
<p>The new features include image support, diff, and xmlPackage.  A factor is the version numbering convention Microsoft has chosen for their <a href="http://blogs.msdn.com/dmahugh/archive/2008/03/13/open-xml-sdk-roadmap.aspx">Open XML SDK</a>: its v2.0 which will first contain an API for WordprocessingML.</p>
<p>So think of a &#8220;level 1&#8243; API as one which handles the Open Packaging conventions (basically, the unzipping step), but leaves you to handle the document (part) content using low level XML (DOM, SAX, etc).</p>
<p>A &#8220;level 2&#8243; API is one which gives you a higher level API to manipulate the part content.  At the very least, this would include objects to represent paragraphs, tables, styles etc.  But you&#8217;d also expect it to be easy, for example, to add a paragraph using a specified style (maybe this is &#8220;level 3&#8243;?  In any case, docx4j can do it)</p>
<p>Given that docx4j brought a &#8220;level 2&#8243; WordML API to the Java world 6 months ago, it is appropriate that it be labelled version 2.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.docx4java.org/blog/2008/07/docx4j-v20-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

