Page 1 of 1

Docx4j Helper AddIn - v8.2.1 available

PostPosted: Thu Aug 06, 2020 6:26 pm
by jason
A new release of the Helper Word AddIn is now available, from https://www.docx4java.org/docx4j/Docx4j ... -2-1-0.exe

This AddIn allows you to see your XML and generate corresponding docx4j Java code directly within Word. So for example, you can create a docx on the fly containing the structure you want, then generate corresponding code inside Word. No need to save the docx. (Or you could open a pre-existing docx if you wanted)

Since everything is done locally, there is no possible leakage of your content to the Internet.

(An alternative to this AddIn is the docx4j webapp, at http://webapp.docx4java.org/ but that does require you to upload a docx. If your content is sensitive, you could anonymise it first locally, if you install docx4j then use https://github.com/plutext/docx4j/blob/ ... ingle.java )

With this release, generating code for textboxes and AlternateContent structures are supported.

For example a docx containing a textbox behind the scenes looks like (some XML omitted for brevity):

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
               <mc:AlternateContent>
                    <mc:Choice Requires="wps">
                        <w:drawing>
                            <wp:anchor xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" allowOverlap="true" behindDoc="false" distB="45720" distL="114300" distR="114300" distT="45720" layoutInCell="true" locked="false" relativeHeight="251659264" simplePos="false" wp14:anchorId="6405C2B6" wp14:editId="4C0BB288">
                                <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
                                    <a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
                                        <wps:wsp xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
                                            <wps:txbx>
                                                <w:txbxContent>
                                                    <w:p w:rsidP="009767B6" w:rsidR="009767B6" w:rsidRDefault="009767B6">
                                                        <w:r>
                                                            <w:t>Some testString</w:t>
                                                        </w:r>
                                                    </w:p>
                                                </w:txbxContent>
                                            </wps:txbx>
                                        </wps:wsp>
                                    </a:graphicData>
                                </a:graphic>
                            </wp:anchor>
                        </w:drawing>
                    </mc:Choice>
                    <mc:Fallback>
                        <w:pict>
                            <v:shapetype xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" coordsize="21600,21600" id="_x0000_t202" path="m,l,21600r21600,l21600,xe" o:spt="202.0">
                                <v:stroke joinstyle="miter"/>
                                <v:path gradientshapeok="t" o:connecttype="rect"/>
                            </v:shapetype>
                            <v:shape xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" id="Text Box 2" style="position:absolute;margin-left:0;margin-top:14.4pt;width:185.9pt;height:110.6pt;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:400;mso-height-percent:200;mso-wrap-distance-left:9pt;mso-wrap-distance-top:3.6pt;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:3.6pt;mso-position-horizontal:center;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:text;mso-width-percent:400;mso-height-percent:200;mso-width-relative:margin;mso-height-relative:margin;v-text-anchor:top" type="#_x0000_t202" >
                                <v:textbox style="mso-fit-shape-to-text:t">
                                    <w:txbxContent>
                                        <w:p w:rsidP="009767B6" w:rsidR="009767B6" w:rsidRDefault="009767B6">
                                            <w:r>
                                                <w:t>Some testString</w:t>
                                            </w:r>
                                        </w:p>
                                    </w:txbxContent>
                                </v:textbox>
                            </v:shape>
                        </w:pict>
                    </mc:Fallback>
                </mc:AlternateContent>
 
Parsed in 0.004 seconds, using GeSHi 1.0.8.4


and this AddIn (or the webapp) can convert that to corresponding Java code (not shown here).