Changeset 1590
- Timestamp:
- 07/03/11 14:03:21 (11 months ago)
- Location:
- trunk/docx4j
- Files:
-
- 2 edited
-
docs/Docx4j_GettingStarted.html (modified) (66 diffs)
-
src/main/java/org/docx4j/samples/CreateHtml.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/docs/Docx4j_GettingStarted.html
r1478 r1590 4 4 /*paged media */ div.header {display: none } 5 5 div.footer {display: none } /*@media print { */ 6 7 div.header {display: block; position: running(header) } 6 8 7 9 div.footer {display: block; position: running(footer) } … … 15 17 /*font definitions*/ 16 18 17 /*element styles*/ del19 /*element styles*/ .del 18 20 {text-decoration:line-through;color:red;} 19 21 20 ins {text-decoration:none;}22 .ins {text-decoration:none;background:#c0ffc0;padding:1px;} 21 23 22 24 … … 29 31 30 32 /* PARAGRAPH STYLES */ 31 .DocDefaults {display:block;space-after: 4mm;line-height: 115%;font- family: Calibri;font-size: 11.0pt;}33 .DocDefaults {display:block;space-after: 4mm;line-height: 115%;font-size: 11.0pt;} 32 34 .Normal {display:block;} 33 .NormalWeb {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font- family: Times New Roman;font-size: 12.0pt;}34 .Command {display:block;position: relative; margin-left: 0.5in;font- family: Consolas;font-size: 10.0pt;}35 .Heading1 {display:block;page-break-after: avoid;space-before: 0.33in;space-after: 4mm;font-weight: bold;color: #365F91;font- family: Calibri;font-size: 18.0pt;}35 .NormalWeb {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font-size: 12.0pt;} 36 .Command {display:block;position: relative; margin-left: 0.5in;font-size: 10.0pt;} 37 .Heading1 {display:block;page-break-after: avoid;space-before: 0.33in;space-after: 4mm;font-weight: bold;color: #365F91;font-size: 18.0pt;} 36 38 .Footer {display:block;space-after: 0in;line-height: 100%;} 37 39 .FootnoteText {display:block;space-after: 0in;line-height: 100%;font-size: 10.0pt;} 38 .Heading2 {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font-weight: bold;font-style: italic;font-family: Calibri;font-size: 14.0pt;} 40 .Header {display:block;space-after: 0in;line-height: 100%;} 41 .Heading2 {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font-weight: bold;font-style: italic;font-size: 14.0pt;} 39 42 .h3 {display:block;font-style: normal;font-size: 11.0pt;text-decoration: none;} 40 .listparagraph0 {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font- family: Times New Roman;font-size: 12.0pt;}41 .Title {display:block;border-bottom-style: solid;border-bottom-width: 0.35mm;border-bottom-color: #4F81BD;space-after: 0.21in;line-height: 100%;color: #17365D;font- family: Calibri;font-size: 26.0pt;}42 .normal0 {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font- family: Times New Roman;font-size: 12.0pt;}43 .listparagraph0 {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font-size: 12.0pt;} 44 .Title {display:block;border-bottom-style: solid;border-bottom-width: 0.35mm;border-bottom-color: #4F81BD;space-after: 0.21in;line-height: 100%;color: #17365D;font-size: 26.0pt;} 45 .normal0 {display:block;space-before: 0.07in;space-after: 0.07in;line-height: 100%;font-size: 12.0pt;} 43 46 .ListParagraph {display:block;position: relative; margin-left: 0.5in;} 44 47 … … 53 56 .underline {display:inline;} 54 57 .Hyperlink {display:inline;color: #0000FF;text-decoration: none;} 55 .HTMLCode {display:inline;font- family: Courier New;font-size: 10.0pt;}58 .HTMLCode {display:inline;font-size: 10.0pt;} 56 59 .icon {display:inline;} 57 60 .apple-converted-space {display:inline;} … … 77 80 </script></head><body> 78 81 79 <!-- userBodyTop goes here --> 80 81 82 <H1>TOP!</H1> 83 84 <div class="header"> 85 86 <p class="Header Normal DocDefaults " /></div> 82 87 83 88 <div class="document"> … … 97 102 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">docx4j is open source, available under the Apache License (v2). As an open source project, contributions are welcome. Please see the docx4j forum at </span><a href="http://dev.plutext.org/forums/"><span style="color: #0000FF;text-decoration: none;">http://dev.plutext.org/forums/</span></a><span style="white-space:pre-wrap;"> for details.</span></p><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"> 98 103 99 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000; font-family: Calibri;text-decoration: none;">The Docx4j social contract</span></p>100 101 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;">docx4j is currently available under the Apache Software license. This gives you freedom to do pretty much anything you like with it. It also means you don't have to pay for it (there is no incentive to take up a commercial license, so we don't offer one).</span></p>102 103 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;"><span style="white-space:pre-wrap;">The </span></span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-style: italic;font-family: Calibri;">quid pro quo</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;"><span style="white-space:pre-wrap;"> is that if docx4j helps you out, you should </span></span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-style: italic;font-family: Calibri;">please</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;"><span style="white-space:pre-wrap;"> "give something back", by way of code, community support, by "spreading the word" (promotion), or by buying commerical support. Your choice. docx4j needs you help to make it easier for people to find it. </span></span></p>104 105 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;">If you choose promotion, your options include:</span></p>106 107 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;">emailing to jharrop@plutext.com a</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Calibri;"><span style="white-space:pre-wrap;"> testimonial which we can put on our </span></span><span style="color: #000000;font-family: Calibri;"><span style="white-space:pre-wrap;">website (preferably with your organization name, but without is worthwhile as well), </span></span></p>108 109 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="color: #000000;font-family: Calibri;"><span style="white-space:pre-wrap;">a </span></span>blog<span style="color: #000000;font-family: Calibri;"> post, a tweet</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;">, or a helpful (non-spammy) comment in an online forum,</span></p>110 111 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;">sharing the content on our blog, following jasonharrop on Twitter, or connecting on LinkedIn.</span></p>112 113 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.03in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;"><span style="white-space:pre-wrap;">Your promotion/support will help grow the docx4j community and thus its strength, to the benefit of all. </span></span></p>114 115 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;"><span style="white-space:pre-wrap;">Please complete our very short new user survey at </span></span><a href="http://www.plutext.com/limesurvey/index.php?sid=78372&lang=en"><span class="Hyperlink DefaultParagraphFont " style="color: #819D26;font-family: Calibri;font-size: 8.0pt;">http://www.plutext.com/limesurvey/index.php?sid=78372</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;">. It includes a question on the above. Thanks.</span></p></div></div>104 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;text-decoration: none;">The Docx4j social contract</span></p> 105 106 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">docx4j is currently available under the Apache Software license. This gives you freedom to do pretty much anything you like with it. It also means you don't have to pay for it (there is no incentive to take up a commercial license, so we don't offer one).</span></p> 107 108 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;">The </span></span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-style: italic;">quid pro quo</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;"> is that if docx4j helps you out, you should </span></span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-style: italic;">please</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;"> "give something back", by way of code, community support, by "spreading the word" (promotion), or by buying commerical support. Your choice. docx4j needs you help to make it easier for people to find it. </span></span></p> 109 110 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">If you choose promotion, your options include:</span></p> 111 112 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">emailing to jharrop@plutext.com a</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;"> testimonial which we can put on our </span></span><span style="color: #000000;"><span style="white-space:pre-wrap;">website (preferably with your organization name, but without is worthwhile as well), </span></span></p> 113 114 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="color: #000000;"><span style="white-space:pre-wrap;">a </span></span>blog<span style="color: #000000;"> post, a tweet</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">, or a helpful (non-spammy) comment in an online forum,</span></p> 115 116 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">sharing the content on our blog, following jasonharrop on Twitter, or connecting on LinkedIn.</span></p> 117 118 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.03in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;">Your promotion/support will help grow the docx4j community and thus its strength, to the benefit of all. </span></span></p> 119 120 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;">Please complete our very short new user survey at </span></span><a href="http://www.plutext.com/limesurvey/index.php?sid=78372&lang=en"><span class="Hyperlink DefaultParagraphFont " style="color: #819D26;font-size: 8.0pt;">http://www.plutext.com/limesurvey/index.php?sid=78372</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">. It includes a question on the above. Thanks.</span></p></div></div> 116 121 117 122 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j relies heavily on </span><span style="font-weight: bold;">JAXB</span>, the JCP standard for Java - XML binding. You can think of docx4j as a JAXB implementation of (amongst others):</p> 118 123 119 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Open Packaging Conventions</p>120 121 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>WordProcessingML (docx) part of Open XML</p>122 123 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">Presentation ML (pptx) part of OpenXML </span></p>124 125 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>SpreadsheetML (xlsx) part of Open XML.</p>124 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Open Packaging Conventions</p> 125 126 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>WordProcessingML (docx) part of Open XML</p> 127 128 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">Presentation ML (pptx) part of OpenXML </span></p> 129 130 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>SpreadsheetML (xlsx) part of Open XML.</p> 126 131 127 132 <p class="Normal DocDefaults ">The library is designed to round trip docx files with 100% fidelity, and supports all 2007 WordML. Support for new Word 2010 features will be added soon.</p> … … 143 148 <p class="Heading1 Normal DocDefaults ">What sorts of things can you do with docx4j?</p> 144 149 145 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Open existing docx (from filesystem, SMB/CIFS, WebDAV using VFS), pptx, xlsx</p>146 147 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Create new docx, pptx, xlsx</p>148 149 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Programmatically manipulate the above (of course)</p>150 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Open existing docx (from filesystem, SMB/CIFS, WebDAV using VFS), pptx, xlsx</p> 151 152 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Create new docx, pptx, xlsx</p> 153 154 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Programmatically manipulate the above (of course)</p> 150 155 151 156 <p class="Normal DocDefaults ">Specific to docx4j (as opposed to pptx4j, xlsx4j):</p> 152 157 153 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Template substitution; CustomXML binding</p>154 155 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Produce/consume Word 2007's xmlPackage (pkg) format</p>156 157 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Save docx to filesystem as a docx (ie zipped), or to JCR (unzipped)</p>158 159 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Apply transforms, including common filters</p>160 161 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Export as HTML or PDF</p>162 163 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Diff/compare documents, paragraphs or sdt (content controls)</p>164 165 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Font support (font substitution, and use of any fonts embedded in the document)</p>158 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Template substitution; CustomXML binding</p> 159 160 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Produce/consume Word 2007's xmlPackage (pkg) format</p> 161 162 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Save docx to filesystem as a docx (ie zipped), or to JCR (unzipped)</p> 163 164 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Apply transforms, including common filters</p> 165 166 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Export as HTML or PDF</p> 167 168 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Diff/compare documents, paragraphs or sdt (content controls)</p> 169 170 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Font support (font substitution, and use of any fonts embedded in the document)</p> 166 171 167 172 <p class="Normal DocDefaults ">This document focuses primarily on docx4j, but the general principles are equally applicable to pptx4j and xlsx4j.</p><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"> 168 173 169 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-style: italic; font-family: Calibri;"><span style="white-space:pre-wrap;">docx4all </span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;"><span style="white-space:pre-wrap;"> is an example of an application based on docx4j; its a Swing-based wordprocessor for docx documents. You can try it or download its source code at </span></span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-family: Calibri;">dev.plutext.org</span></p></div></div>174 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-style: italic;"><span style="white-space:pre-wrap;">docx4all </span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;"><span style="white-space:pre-wrap;"> is an example of an application based on docx4j; its a Swing-based wordprocessor for docx documents. You can try it or download its source code at </span></span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;">dev.plutext.org</span></p></div></div> 170 175 171 176 <p class="Normal DocDefaults " /> … … 205 210 <p class="Normal DocDefaults ">The two to try (both discussed in detail further below) are:</p> 206 211 207 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>OpenMainDocumentAndTraverse</p>208 209 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>PartsList</p>212 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>OpenMainDocumentAndTraverse</p> 213 214 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>PartsList</p> 210 215 211 216 <p class="Normal DocDefaults ">Invoke with a command like:</p> 212 217 213 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Courier New;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.OpenMainDocumentAndTraverse [input.docx]</span></p>214 215 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Trebuchet MS;font-size: 8.0pt;">If there are any images in the docx, you'd also need:</span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;">   xmlgraphics-commons-1.4.jar</span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;">   commons-logging-1.1.1.jar</span></p>218 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.OpenMainDocumentAndTraverse [input.docx]</span></p> 219 220 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">If there are any images in the docx, you'd also need:</span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   xmlgraphics-commons-1.4.jar</span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   commons-logging-1.1.1.jar</span></p> 216 221 217 222 <p class="Normal DocDefaults ">on your classpath.</p> … … 227 232 <p class="Normal DocDefaults ">If you are using Eclipse to run things, in the run configuration:</p> 228 233 229 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">add VM argument </span><br clear="all" /><br clear="all" />   -Dlog4j.configuration=log4j.xml<br clear="all" /></p>230 231 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>to the classpath, add a user entry (click "advanced..") for<br clear="all" /><br clear="all" />   src/main/resources</p>234 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">add VM argument </span><br clear="all" /><br clear="all" />   -Dlog4j.configuration=log4j.xml<br clear="all" /></p> 235 236 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>to the classpath, add a user entry (click "advanced..") for<br clear="all" /><br clear="all" />   src/main/resources</p> 232 237 233 238 <p class="Heading2 Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">images</span></p> 234 239 235 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Trebuchet MS;font-size: 8.0pt;">If there are any images in the docx, you'll also need:</span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;">   xmlgraphics-commons-1.4.jar</span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Trebuchet MS;font-size: 8.0pt;">   which in turn requires commons-logging-1.1.1.jar</span></p>240 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">If there are any images in the docx, you'll also need:</span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   xmlgraphics-commons-1.4.jar</span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   which in turn requires commons-logging-1.1.1.jar</span></p> 236 241 237 242 <p class="Heading2 Normal DocDefaults "><span style="white-space:pre-wrap;">other dependencies </span></p> … … 311 316 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">JAXB is included in Sun's Java 6 distributions, but not 1.5. So if you are using the 1.5 JDK, you will need JAXB 2.1.x on your class path. </span></p> 312 317 313 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Bits of docx4j, such as </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span class="Hyperlink DefaultParagraphFont ">org.docx4j.wml</span></a><span style="white-space:pre-wrap;"> and </span><span class="apple-converted-space DefaultParagraphFont " style="font-family: Calibri;"> </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/dml"><span class="Hyperlink DefaultParagraphFont ">org.docx4j.dml</span></a><span style="white-space:pre-wrap;"> were generated using JAXB's XJC. We modified the wml.xsd schema in particular, so that the key resulting classes are a bit more human friendly (ie don't all start with CT_ and ST_). </span></p>318 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Bits of docx4j, such as </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span class="Hyperlink DefaultParagraphFont ">org.docx4j.wml</span></a><span style="white-space:pre-wrap;"> and </span><span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/dml"><span class="Hyperlink DefaultParagraphFont ">org.docx4j.dml</span></a><span style="white-space:pre-wrap;"> were generated using JAXB's XJC. We modified the wml.xsd schema in particular, so that the key resulting classes are a bit more human friendly (ie don't all start with CT_ and ST_). </span></p> 314 319 315 320 <p class="Heading1 Normal DocDefaults ">Javadoc</p> … … 321 326 <p class="Normal DocDefaults ">To obtain a copy of the current source code:</p> 322 327 323 <p class="NormalWeb Normal DocDefaults ">   <span style="font- family: Consolas;font-size: 10.0pt;">svn co</span><span class="apple-converted-space DefaultParagraphFont " style="font-family: Consolas;font-size: 10.0pt;"> </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j"><span class="icon DefaultParagraphFont " style="font-family: Consolas;font-size: 10.0pt;">http://dev.plutext.org/svn/docx4j/trunk/docx4j</span></a><span class="apple-converted-space DefaultParagraphFont " style="font-family: Consolas;font-size: 10.0pt;"> </span><span style="font-family: Consolas;font-size: 10.0pt;">docx4j</span></p>328 <p class="NormalWeb Normal DocDefaults ">   <span style="font-size: 10.0pt;">svn co</span><span class="apple-converted-space DefaultParagraphFont " style="font-size: 10.0pt;"> </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j"><span class="icon DefaultParagraphFont " style="font-size: 10.0pt;">http://dev.plutext.org/svn/docx4j/trunk/docx4j</span></a><span class="apple-converted-space DefaultParagraphFont " style="font-size: 10.0pt;"> </span><span style="font-size: 10.0pt;">docx4j</span></p> 324 329 325 330 <p class="Normal DocDefaults ">Alternatively, you can browse it online, at:</p> … … 335 340 <p class="Normal DocDefaults ">Create a directory called workspace, and cd into it.</p> 336 341 337 <p class="NormalWeb Normal DocDefaults ">   <span style="font- family: Consolas;font-size: 10.0pt;">svn co</span><span class="apple-converted-space DefaultParagraphFont " style="font-family: Consolas;font-size: 10.0pt;"> </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j"><span class="icon DefaultParagraphFont " style="font-family: Consolas;font-size: 10.0pt;">http://dev.plutext.org/svn/docx4j/trunk/docx4j</span></a><span class="apple-converted-space DefaultParagraphFont " style="font-family: Consolas;font-size: 10.0pt;"> </span><span style="font-family: Consolas;font-size: 10.0pt;">docx4j</span></p>342 <p class="NormalWeb Normal DocDefaults ">   <span style="font-size: 10.0pt;">svn co</span><span class="apple-converted-space DefaultParagraphFont " style="font-size: 10.0pt;"> </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j"><span class="icon DefaultParagraphFont " style="font-size: 10.0pt;">http://dev.plutext.org/svn/docx4j/trunk/docx4j</span></a><span class="apple-converted-space DefaultParagraphFont " style="font-size: 10.0pt;"> </span><span style="font-size: 10.0pt;">docx4j</span></p> 338 343 339 344 <p class="Normal DocDefaults ">open pom.xml, find the line which reads</p> … … 343 348 <p class="Normal DocDefaults ">and edit it to suit your system.</p> 344 349 345 <p class="Command NormalWeb Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;">export MAVEN_OPTS=-Xmx512m</span><span style="color: #000000;font-family: Calibri;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Calibri;">mvn install -Dmaven.test.skip=true</span></p>350 <p class="Command NormalWeb Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">export MAVEN_OPTS=-Xmx512m</span><span style="color: #000000;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">mvn install -Dmaven.test.skip=true</span></p> 346 351 347 352 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">That will install the dependencies and all being well, create a jar. </span></p> … … 349 354 <p class="Normal DocDefaults ">Once the dependencies are installed, you can also build docx4j using ant:</p> 350 355 351 <p class="Normal DocDefaults "><span style="font- family: Consolas;font-size: 10.0pt;">   ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m" ant dist</span></p>356 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">   ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m" ant dist</span></p> 352 357 353 358 <p class="Normal DocDefaults ">That ant command will create the docx4j.jar and place it and all its dependencies in the dist dir.</p> … … 357 362 <p class="h3 Heading2 Normal DocDefaults ">Prerequisites</p> 358 363 359 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Eclipse installed</p>360 361 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Install an Eclipse subversion plugin eg<span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://subclipse.tigris.org/update_1.2.x"><span class="icon DefaultParagraphFont ">http://subclipse.tigris.org/update_1.2.x</span></a></p>362 363 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Install<span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://dev.plutext.org/trac/docx4j/trac/umbrella/wiki/MavenEclipse"><span class="Hyperlink DefaultParagraphFont " style="font-family: Calibri;">Maven and the Eclipse plugin</span></a></p>364 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Eclipse installed</p> 365 366 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Install an Eclipse subversion plugin eg<span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://subclipse.tigris.org/update_1.2.x"><span class="icon DefaultParagraphFont ">http://subclipse.tigris.org/update_1.2.x</span></a></p> 367 368 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Install<span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://dev.plutext.org/trac/docx4j/trac/umbrella/wiki/MavenEclipse"><span class="Hyperlink DefaultParagraphFont ">Maven and the Eclipse plugin</span></a></p> 364 369 365 370 <p class="Normal DocDefaults ">And, as discussed above:</p> 366 371 367 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Java 1.5 or 6</p>368 369 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">JAXB: </span><span style="font-weight: bold;">either</span><span style="white-space:pre-wrap;"> the JAXB implementation included in Java 6, </span><span style="font-weight: bold;">or</span><span style="white-space:pre-wrap;"> the 2.x reference implementation. </span></p>372 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Java 1.5 or 6</p> 373 374 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">JAXB: </span><span style="font-weight: bold;">either</span><span style="white-space:pre-wrap;"> the JAXB implementation included in Java 6, </span><span style="font-weight: bold;">or</span><span style="white-space:pre-wrap;"> the 2.x reference implementation. </span></p> 370 375 371 376 <p class="h3 Heading2 Normal DocDefaults ">Instructions</p> 372 377 373 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>File > New "Project .." > SVN > Checkout Projects from SVN</p>374 375 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Create a new repository location; Url is<span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://dev.plutext.org/svn/docx4j"><span class="icon DefaultParagraphFont ">http://dev.plutext.org/svn/docx4j</span></a></p>376 377 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Click folder "trunk", and select docx4j; click next</p>378 379 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>You want to check it out as a project configured using the New Project Wizard</p>380 381 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Then select Java > Java Project; click Next</p>382 383 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Choose a project name (eg docx4j) then click Next</p>384 385 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Click Finish (we'll define the Java build settings in a later step)</p>378 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>File > New "Project .." > SVN > Checkout Projects from SVN</p> 379 380 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Create a new repository location; Url is<span class="apple-converted-space DefaultParagraphFont "> </span><a href="http://dev.plutext.org/svn/docx4j"><span class="icon DefaultParagraphFont ">http://dev.plutext.org/svn/docx4j</span></a></p> 381 382 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Click folder "trunk", and select docx4j; click next</p> 383 384 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>You want to check it out as a project configured using the New Project Wizard</p> 385 386 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Then select Java > Java Project; click Next</p> 387 388 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Choose a project name (eg docx4j) then click Next</p> 389 390 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Click Finish (we'll define the Java build settings in a later step)</p> 386 391 387 392 <p class="Normal DocDefaults ">After a couple of other dialog boxes, you should have the new project in your workspace.</p> 388 393 389 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Now, we need to configure the </span><span style="font-weight: bold;">class path</span><span style="white-space:pre-wrap;"> etc within Eclipse so that it can build.</span></p>390 391 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span>Build Path > Configure Build Path > Java Build Path > Source tab</p>392 393 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span>Click on src, then press the remove button</p>394 395 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span>Then click "add folder" and navigate through to src/main/java and tick 'java'</p>396 397 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span>Then add</p>398 399 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Courier New;">o </span>src/diffx</p>400 401 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Courier New;">o </span>src/pptx4j/java</p>402 403 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Courier New;">o </span>src/xlsx4j/java</p>404 405 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Courier New;">o </span>src/svg</p>406 407 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Courier New;">o </span>src/xslfo</p>408 409 394 <p class="Normal DocDefaults ">The Maven bit:</p> 410 395 411 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">Make sure you have Maven and its plugin installed - see Prerequisites above. </span></p> 412 413 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span>Run mvn install in the docx4j dir from a command prompt (just in case)</p> 414 415 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;font-family: Symbol;">ï· </span>Right click on project > Maven 2 > Enable</p> 396 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">Make sure you have Maven and its plugin installed - see Prerequisites above. </span></p> 397 398 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Run mvn install in the docx4j dir from a command prompt (just in case)</p> 399 400 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Right click on project > Maven 2 > EnableDependency Management</p> 401 402 <p class="Normal DocDefaults ">Finally, in project properties > Java compiler, change "Compiler compliance level" to 1.6.</p> 416 403 417 404 <p class="Normal DocDefaults ">The project should now be working in Eclipse without errors<span class="FootnoteReference DefaultParagraphFont "><span style="vertical-align: top; font-size: xx-small"><a name="fs2"><a href="#fn2">2</a></a></span></span><span style="white-space:pre-wrap;">. </span></p> 418 405 419 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Open an existing docx/pptx/xlsx document</span></p>420 421 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java"><span style="font-family: Consolas;">org.docx4j.openpackaging.packages.</span><span style="font-weight: bold;font-family: Consolas;">WordprocessingMLPackage</span></a> represents a docx document.</p>406 <p class="Heading1 Normal DocDefaults "><span>Open an existing docx/pptx/xlsx document</span></p> 407 408 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java"><span>org.docx4j.openpackaging.packages.</span><span style="font-weight: bold;">WordprocessingMLPackage</span></a> represents a docx document.</p> 422 409 423 410 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">To load a document, all you have to do is:</p> … … 429 416 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">You can then get the main document part (word/document.xml):</p> 430 417 431 <p class="Command NormalWeb Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/MainDocumentPart.java"><span style="font-family: Calibri;">MainDocumentPart</span></a> documentPart = wordMLPackage.getMainDocumentPart();</p>418 <p class="Command NormalWeb Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/MainDocumentPart.java"><span>MainDocumentPart</span></a> documentPart = wordMLPackage.getMainDocumentPart();</p> 432 419 433 420 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">After that, you can manipulate its contents. </span></p> … … 435 422 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">WordprocessingMLPackage.load uses </span></p> 436 423 437 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">LoadFromZipNG loader = </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 8.0pt;">new</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> LoadFromZipNG();</span></span></p>424 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">LoadFromZipNG loader = </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">new</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> LoadFromZipNG();</span></span></p> 438 425 439 426 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">If you need to load a docx from an input stream, you can do something like:</p> 440 427 441 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   WordprocessingMLPackage pkg = (WordprocessingMLPackage)loader.get(stream);</span></p>428 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   WordprocessingMLPackage pkg = (WordprocessingMLPackage)loader.get(stream);</span></p> 442 429 443 430 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">A similar approach works for pptx files:</p> 444 431 445 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">PresentationMLPackage presentationMLPackage = </span></span></p>446 447 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   (PresentationMLPackage)OpcPackage.</span><span style="color: #000000;font-style: italic;font-family: Consolas;font-size: 8.0pt;">load</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">(</span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 8.0pt;">new</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> java.io.File(inputfilepath));</span></span></p>432 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">PresentationMLPackage presentationMLPackage = </span></span></p> 433 434 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   (PresentationMLPackage)OpcPackage.</span><span style="color: #000000;font-style: italic;font-size: 8.0pt;">load</span><span style="color: #000000;font-size: 8.0pt;">(</span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">new</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> java.io.File(inputfilepath));</span></span></p> 448 435 449 436 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">And similarly for xlsx files.</p> … … 465 452 <p class="Normal DocDefaults ">An introduction to WordML is beyond the scope of this document. You can find a very readable introduction in 1<span style="vertical-align: top;font-size: xx-small;">st</span><span style="white-space:pre-wrap;"> edition Part 3 (Primer) at </span><a href="http://www.ecma-international.org/publications/standards/Ecma-376.htm"><span style="color: #0000FF;text-decoration: none;">http://www.ecma-international.org/publications/standards/Ecma-376.htm</span></a><span style="white-space:pre-wrap;"> or </span><a href="http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm"><span style="color: #0000FF;text-decoration: none;">http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm</span></a><span style="white-space:pre-wrap;"> (a better link for the 1st edition (Dec 2006), since its not zipped up). </span></p> 466 453 467 <p class="Heading1 Normal DocDefaults "><a name="_Ref280708892" /><span style="font-family: Calibri;">Specification versions</span><span style="font-family: Calibri;"><span style="white-space:pre-wrap;"> </span></span></p>454 <p class="Heading1 Normal DocDefaults "><a name="_Ref280708892" /><span>Specification versions</span><span><span style="white-space:pre-wrap;"> </span></span></p> 468 455 469 456 <p class="Normal DocDefaults ">From Wikipedia:</p> 470 457 471 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Arial;font-size: 8.0pt;">The</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/Office_Open_XML"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-family: Arial;font-size: 8.0pt;">Office Open XML</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"><span style="white-space:pre-wrap;">file formats were standardised between December 2006 and November 2008, </span></span></p>472 473 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Arial;font-size: 8.0pt;">first by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/Ecma_International"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-family: Arial;font-size: 8.0pt;">Ecma International</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;">consortium (where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-family: Arial;font-size: 8.0pt;">ECMA-376</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"><span style="white-space:pre-wrap;">), </span></span></p>474 475 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Arial;font-size: 8.0pt;">and subsequently .. by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-family: Arial;font-size: 8.0pt;">ISO</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;">/</span><a href="http://en.wikipedia.org/wiki/International_Electrotechnical_Commission"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-family: Arial;font-size: 8.0pt;">IEC</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;">'s</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization #ISO.2FIEC_Joint_Technical_Committee_1"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-family: Arial;font-size: 8.0pt;">Joint Technical Committee 1</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;">(where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-family: Arial;font-size: 8.0pt;">ISO/IEC 29500:2008</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Arial;font-size: 8.0pt;">).</span></p>476 477 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">The Ecma-376.htm link also contains the 2nd edition documents (of Dec 2008), which are </span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font- family: Verdana;font-size: 8.5pt;">"</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-family: Verdana;font-size: 8.5pt;">technically aligned with ISO/IEC 29500".</span></p>478 479 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font- family: Verdana;font-size: 8.5pt;">Office 2007 SP2 implements ECMA-376 1st Edition</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;font-family: Verdana;font-size: 8.5pt;"><span style="vertical-align: top; font-size: xx-small"><a name="fs3"><a href="#fn3">3</a></a></span></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-family: Verdana;font-size: 8.5pt;">; this is what docx4j implements.</span></p>480 481 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font- family: Arial;font-size: 8.5pt;">ISO/IEC 29500 (</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-family: Verdana;font-size: 8.5pt;">ECMA-376 2nd Edition) has</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;font-family: Arial;font-size: 8.5pt;">Strict</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;">and</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;font-family: Arial;font-size: 8.5pt;"><span style="white-space:pre-wrap;">Transitional </span></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;">conformance classes. Office 2010 supports</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;"><span style="vertical-align: top; font-size: xx-small"><a name="fs4"><a href="#fn4">4</a></a></span></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-family: Arial;font-size: 8.5pt;"><span style="white-space:pre-wrap;"> transitional, and also has read only support for strict.</span></span></p>482 483 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Architecture</span></p>458 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">The</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/Office_Open_XML"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-size: 8.0pt;">Office Open XML</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">file formats were standardised between December 2006 and November 2008, </span></span></p> 459 460 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">first by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/Ecma_International"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-size: 8.0pt;">Ecma International</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">consortium (where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 8.0pt;">ECMA-376</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">), </span></span></p> 461 462 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">and subsequently .. by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-size: 8.0pt;">ISO</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">/</span><a href="http://en.wikipedia.org/wiki/International_Electrotechnical_Commission"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-size: 8.0pt;">IEC</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">'s</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><a href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization #ISO.2FIEC_Joint_Technical_Committee_1"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;font-size: 8.0pt;">Joint Technical Committee 1</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">(where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 8.0pt;">ISO/IEC 29500:2008</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">).</span></p> 463 464 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">The Ecma-376.htm link also contains the 2nd edition documents (of Dec 2008), which are </span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">"</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">technically aligned with ISO/IEC 29500".</span></p> 465 466 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">Office 2007 SP2 implements ECMA-376 1st Edition</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;"><span style="vertical-align: top; font-size: xx-small"><a name="fs3"><a href="#fn3">3</a></a></span></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">; this is what docx4j implements.</span></p> 467 468 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">ISO/IEC 29500 (</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">ECMA-376 2nd Edition) has</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;font-size: 8.5pt;">Strict</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">and</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;font-size: 8.5pt;"><span style="white-space:pre-wrap;">Transitional </span></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;">conformance classes. Office 2010 supports</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;"><span style="vertical-align: top; font-size: xx-small"><a name="fs4"><a href="#fn4">4</a></a></span></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-size: 8.5pt;"><span style="white-space:pre-wrap;"> transitional, and also has read only support for strict.</span></span></p> 469 470 <p class="Heading1 Normal DocDefaults "><span>Architecture</span></p> 484 471 485 472 <p class="Normal DocDefaults ">Docx4j has 3 layers:</p> 486 473 487 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">1. </span><span style="font-weight: bold; font-family: Consolas;">org.docx4j.openpackaging</span><br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">OpenPackaging handles things at the Open Packaging Conventions level: unzipping a docx into </span><span style="font-weight: bold;font-family: Consolas;">WordprocessingMLPackage</span><span style="white-space:pre-wrap;"> and a set of objects inheriting from Part; allowing parts to be added/deleted; saving the docx</span><br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">This layer is based originally on OpenXML4J (which is also used by Apache POI). </span><br clear="all" /></p>488 489 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">2. </span><span style="white-space:pre-wrap;">Parts are generally subclasses of </span><span style="font-weight: bold;color: #000000; font-family: Consolas;">org</span><span style="font-weight: bold;font-family: Consolas;">.docx4j.</span><span style="font-weight: bold;color: #000000;font-family: Consolas;">openpackaging</span><span style="font-weight: bold;font-family: Consolas;">.parts.JaxbXmlPart</span><br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">This (the </span><span style="font-weight: bold;color: #000000;">jaxb</span><span style="font-weight: bold;"><span style="white-space:pre-wrap;"> content tree</span></span>) is the second level of the three layered model.<br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">Parts are arranged in a tree. If a part has descendants, it will have a </span><span style="font-weight: bold;font-family: Consolas;">org.docx4j.openpackaging.parts.relationships.RelationshipsPart</span><span style="white-space:pre-wrap;"> which identifies those descendant parts. The sample PartsList (see next section) shows you how this works.</span><br clear="all" /><br clear="all" />A JaxbXmlPart has a content tree:<br clear="all" /><br clear="all" /><span style="font-family: Consolas;font-size: 9.0pt;">   public Object getJaxbElement() {</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="font-family: Consolas;font-size: 9.0pt;">   </span><span style="font-family: Consolas;font-size: 9.0pt;">   return jaxbElement;</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="font-family: Consolas;font-size: 9.0pt;">   }</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="font-family: Consolas;font-size: 9.0pt;">   public void setJaxbElement(Object jaxbElement) {</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="font-family: Consolas;font-size: 9.0pt;">   </span><span style="font-family: Consolas;font-size: 9.0pt;">   this.jaxbElement = jaxbElement;</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="font-family: Consolas;font-size: 9.0pt;">   }</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span></p>490 491 <p class="ListParagraph Normal DocDefaults "><span style="white-space:pre-wrap;">Most parts (including MainDocumentPart, styles, headers/footers, comments, </span><span style="color: #000000;">endnotes</span><span style="white-space:pre-wrap;">/footnotes) use </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span style="font-weight: bold; font-family: Consolas;">org.docx4j.wml</span></a><span style="font-weight: bold;font-family: Consolas;"><span style="white-space:pre-wrap;"> </span></span><span style="white-space:pre-wrap;">(WordprocessingML); </span><span style="color: #000000;">wml</span><span style="white-space:pre-wrap;"> references </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span style="font-weight: bold;font-family: Consolas;">org.docx4j.dml</span></a><span style="font-weight: bold;font-family: Consolas;"><span style="white-space:pre-wrap;"> </span></span>(DrawingML) as necessary.<br clear="all" /><br clear="all" />These classes were generated from the Open XML schemas<br clear="all" /></p>492 493 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">3. </span><span style="font-weight: bold; font-family: Consolas;">org.docx4j.model</span><span style="font-weight: bold;font-family: Consolas;"><br clear="all" /></span><span style="font-weight: bold;font-family: Consolas;"><br clear="all" /></span><span style="white-space:pre-wrap;">This package builds on the lower two layers to provide extra functionality, and is being progressively further developed. </span></p>494 495 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;"><span style="white-space:pre-wrap;">Jaxb: marshalling and unmarshalling </span></span></p>496 497 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j contains a class representing each part. For example, there is a </span><span style="font-family: Consolas;">MainDocumentPart</span><span style="white-space:pre-wrap;"> class. XML parts inherit from </span><span style="font-family: Consolas;">JaxbXmlPart</span><span style="white-space:pre-wrap;">, which contains a member called </span><span style="font-weight: bold;font-family: Consolas;">jaxbElement</span>. When you want to work with the contents of a part, you work with its jaxbElement.</p>474 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">1. </span><span style="font-weight: bold;">org.docx4j.openpackaging</span><br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">OpenPackaging handles things at the Open Packaging Conventions level: unzipping a docx into </span><span style="font-weight: bold;">WordprocessingMLPackage</span><span style="white-space:pre-wrap;"> and a set of objects inheriting from Part; allowing parts to be added/deleted; saving the docx</span><br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">This layer is based originally on OpenXML4J (which is also used by Apache POI). </span><br clear="all" /></p> 475 476 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">2. </span><span style="white-space:pre-wrap;">Parts are generally subclasses of </span><span style="font-weight: bold;color: #000000;">org</span><span style="font-weight: bold;">.docx4j.</span><span style="font-weight: bold;color: #000000;">openpackaging</span><span style="font-weight: bold;">.parts.JaxbXmlPart</span><br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">This (the </span><span style="font-weight: bold;color: #000000;">jaxb</span><span style="font-weight: bold;"><span style="white-space:pre-wrap;"> content tree</span></span>) is the second level of the three layered model.<br clear="all" /><br clear="all" /><span style="white-space:pre-wrap;">Parts are arranged in a tree. If a part has descendants, it will have a </span><span style="font-weight: bold;">org.docx4j.openpackaging.parts.relationships.RelationshipsPart</span><span style="white-space:pre-wrap;"> which identifies those descendant parts. The sample PartsList (see next section) shows you how this works.</span><br clear="all" /><br clear="all" />A JaxbXmlPart has a content tree:<br clear="all" /><br clear="all" /><span style="font-size: 9.0pt;">   public Object getJaxbElement() {</span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="font-size: 9.0pt;">   </span><span style="font-size: 9.0pt;">   return jaxbElement;</span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="font-size: 9.0pt;">   }</span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="font-size: 9.0pt;">   public void setJaxbElement(Object jaxbElement) {</span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="font-size: 9.0pt;">   </span><span style="font-size: 9.0pt;">   this.jaxbElement = jaxbElement;</span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="font-size: 9.0pt;">   }</span><span style="font-size: 9.0pt;"><br clear="all" /></span></p> 477 478 <p class="ListParagraph Normal DocDefaults "><span style="white-space:pre-wrap;">Most parts (including MainDocumentPart, styles, headers/footers, comments, </span><span style="color: #000000;">endnotes</span><span style="white-space:pre-wrap;">/footnotes) use </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span style="font-weight: bold;">org.docx4j.wml</span></a><span style="font-weight: bold;"><span style="white-space:pre-wrap;"> </span></span><span style="white-space:pre-wrap;">(WordprocessingML); </span><span style="color: #000000;">wml</span><span style="white-space:pre-wrap;"> references </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span style="font-weight: bold;">org.docx4j.dml</span></a><span style="font-weight: bold;"><span style="white-space:pre-wrap;"> </span></span>(DrawingML) as necessary.<br clear="all" /><br clear="all" />These classes were generated from the Open XML schemas<br clear="all" /></p> 479 480 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">3. </span><span style="font-weight: bold;">org.docx4j.model</span><span style="font-weight: bold;"><br clear="all" /></span><span style="font-weight: bold;"><br clear="all" /></span><span style="white-space:pre-wrap;">This package builds on the lower two layers to provide extra functionality, and is being progressively further developed. </span></p> 481 482 <p class="Heading1 Normal DocDefaults "><span><span style="white-space:pre-wrap;">Jaxb: marshalling and unmarshalling </span></span></p> 483 484 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j contains a class representing each part. For example, there is a </span><span>MainDocumentPart</span><span style="white-space:pre-wrap;"> class. XML parts inherit from </span><span>JaxbXmlPart</span><span style="white-space:pre-wrap;">, which contains a member called </span><span style="font-weight: bold;">jaxbElement</span>. When you want to work with the contents of a part, you work with its jaxbElement.</p> 498 485 499 486 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">When you open a docx document using docx4j, docx4j automatically </span><span style="font-weight: bold;font-style: italic;">unmarshals</span><span style="white-space:pre-wrap;"> the contents of each XML part to a strongly-type Java object tree (the jaxbElement).</span></p> … … 501 488 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Similarly, if/when you tell docx4j to save these Java objects as a docx, docx4j automatically </span><span style="font-weight: bold;font-style: italic;">marshals</span><span style="white-space:pre-wrap;"> the jaxbElement in each Part.</span></p> 502 489 503 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Sometimes you will want to marshal or unmarshal things yourself. The class </span><span style="font-weight: bold;color: #000000;font- family: Consolas;font-size: 9.0pt;">org.docx4j.jaxb.Context</span><span style="white-space:pre-wrap;"> defines all the JAXBContexts used in docx4j: </span></p>490 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Sometimes you will want to marshal or unmarshal things yourself. The class </span><span style="font-weight: bold;color: #000000;font-size: 9.0pt;">org.docx4j.jaxb.Context</span><span style="white-space:pre-wrap;"> defines all the JAXBContexts used in docx4j: </span></p> 504 491 505 492 <table class="TableGrid TableNormal " id="docx4j_tbl_1" style="position: relative; margin-left: 0.76in;table-layout: fixed;border-collapse: collapse;"><colgroup><col style="width: 2in;" /><col style="width: 2.94in;" /></colgroup><tbody><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 506 493 507 <p class="Normal DocDefaults "><span style="font- family: Consolas;font-size: 9.0pt;">Jc</span></p></td><td>508 509 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.wml</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml.picture</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml.wordprocessingDrawing</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.vml</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.vml.officedrawing</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.math</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">510 511 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcThemePart</span></p></td><td>512 513 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.dml</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">514 515 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcDocPropsCore</span></p></td><td>516 517 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.docProps.core</span></p>518 519 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.docProps.core.dc.elements</span></p>520 521 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.docProps.core.dc.terms</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">522 523 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcDocPropsCustom</span></p></td><td>524 525 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.docProps.custom</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">526 527 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcDocPropsExtended</span></p></td><td>528 529 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.docProps.extended</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">530 531 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcXmlPackage</span></p></td><td>532 533 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.xmlPackage</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">534 535 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcRelationships</span></p></td><td>536 537 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.relationships</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">538 539 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcCustomXmlProperties</span></p></td><td>540 541 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.customXmlProperties</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">542 543 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcContentTypes</span></p></td><td>544 545 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.openpackaging.contenttype</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;">546 547 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;">jcPML</span></p></td><td>548 549 <p class="Normal DocDefaults "><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.pml</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml.picture</span></p></td></tr></tbody></table>494 <p class="Normal DocDefaults "><span style="font-size: 9.0pt;">Jc</span></p></td><td> 495 496 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.wml</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml.picture</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml.wordprocessingDrawing</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.vml</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.vml.officedrawing</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.math</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 497 498 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcThemePart</span></p></td><td> 499 500 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.dml</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 501 502 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcDocPropsCore</span></p></td><td> 503 504 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.docProps.core</span></p> 505 506 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.docProps.core.dc.elements</span></p> 507 508 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.docProps.core.dc.terms</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 509 510 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcDocPropsCustom</span></p></td><td> 511 512 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.docProps.custom</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 513 514 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcDocPropsExtended</span></p></td><td> 515 516 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.docProps.extended</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 517 518 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcXmlPackage</span></p></td><td> 519 520 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.xmlPackage</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 521 522 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcRelationships</span></p></td><td> 523 524 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.relationships</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 525 526 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcCustomXmlProperties</span></p></td><td> 527 528 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.customXmlProperties</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 529 530 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcContentTypes</span></p></td><td> 531 532 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.openpackaging.contenttype</span></p></td></tr><tr style="vertical-align: top;"><td style="vertical-align: middle;"> 533 534 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">jcPML</span></p></td><td> 535 536 <p class="Normal DocDefaults "><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.pml</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml</span><span style="color: #2A00FF;font-size: 9.0pt;"><br clear="all" />org.docx4j.dml.picture</span></p></td></tr></tbody></table> 550 537 551 538 <p class="Normal DocDefaults " /> 552 539 553 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Parts List</span></p>554 555 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">To get a better understanding of how docx4j works â and the structure of a docx document â you can run the PartsList sample on a docx (or a pptx or xlsx). If you do, it will list the hierarchy of parts used in that package. It will tell you which class is used to represent each part, and where that part is a JaxbXmlPart, it will also tell you what class the </span><span style="font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">jaxbElement </span></span>is.</p>540 <p class="Heading1 Normal DocDefaults "><span>Parts List</span></p> 541 542 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">To get a better understanding of how docx4j works â and the structure of a docx document â you can run the PartsList sample on a docx (or a pptx or xlsx). If you do, it will list the hierarchy of parts used in that package. It will tell you which class is used to represent each part, and where that part is a JaxbXmlPart, it will also tell you what class the </span><span style="font-size: 9.0pt;"><span style="white-space:pre-wrap;">jaxbElement </span></span>is.</p> 556 543 557 544 <p class="Normal DocDefaults ">You can run it from a command line:</p> 558 545 559 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Courier New;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.PartsList [input.docx]</span></p>560 561 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Trebuchet MS;font-size: 8.0pt;">If there are any images in the docx, you'd also need to add to your classpath: xmlgraphics-commons-1.4.jar and commons-logging-1.1.1.jar</span></p>546 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.PartsList [input.docx]</span></p> 547 548 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">If there are any images in the docx, you'd also need to add to your classpath: xmlgraphics-commons-1.4.jar and commons-logging-1.1.1.jar</span></p> 562 549 563 550 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">For example: </span></p> 564 551 565 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">Part /_rels/.rels [org.docx4j.openpackaging.parts.relationships.RelationshipsPart]</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.relationships.Relationships</span></span></p>566 567 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 568 569 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">Part /docProps/app.xml [org.docx4j.openpackaging.parts.DocPropsExtendedPart] </span></span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.docProps.extended.Properties</span></span></p>552 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">Part /_rels/.rels [org.docx4j.openpackaging.parts.relationships.RelationshipsPart]</span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.relationships.Relationships</span></span></p> 553 554 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 555 556 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">Part /docProps/app.xml [org.docx4j.openpackaging.parts.DocPropsExtendedPart] </span></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.docProps.extended.Properties</span></span></p> 570 557 571 558 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;" /> 572 559 573 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">Part /docProps/core.xml [org.docx4j.openpackaging.parts.DocPropsCorePart] </span></span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.docProps.core.CoreProperties</span></span></p>560 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">Part /docProps/core.xml [org.docx4j.openpackaging.parts.DocPropsCorePart] </span></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.docProps.core.CoreProperties</span></span></p> 574 561 575 562 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;" /> 576 563 577 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">Part </span></span><span style="font-weight: bold;color: #000000;font-family: Consolas;font-size: 8.0pt;">/word/document.xml</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> [org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart] </span></span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.wml.Document</span></span></p>564 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">Part </span></span><span style="font-weight: bold;color: #000000;font-size: 8.0pt;">/word/document.xml</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> [org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart] </span></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.wml.Document</span></span></p> 578 565 579 566 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;" /> 580 567 581 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">Part /word/settings.xml [</span><span style="color: #000000;font-family: Consolas;font-size: 7.0pt;">org.docx4j.openpackaging.parts.WordprocessingML</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">.DocumentSettingsPart] </span></span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.wml.CTSettings</span></span></p>568 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">Part /word/settings.xml [</span><span style="color: #000000;font-size: 7.0pt;">org.docx4j.openpackaging.parts.WordprocessingML</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">.DocumentSettingsPart] </span></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.wml.CTSettings</span></span></p> 582 569 583 570 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;" /> 584 571 585 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">Part /word/styles.xml [</span><span style="color: #000000;font-family: Consolas;font-size: 7.0pt;">org.docx4j.openpackaging.parts.WordprocessingML</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">.StyleDefinitionsPart] </span></span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.wml.Styles</span></span></p>572 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">Part /word/styles.xml [</span><span style="color: #000000;font-size: 7.0pt;">org.docx4j.openpackaging.parts.WordprocessingML</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">.StyleDefinitionsPart] </span></span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /><span style="white-space:pre-wrap;"> containing JaxbElement:org.docx4j.wml.Styles</span></span></p> 586 573 587 574 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;" /> 588 575 589 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">Part /word/media/image1.jpeg [</span><span style="color: #000000;font-family: Consolas;font-size: 7.0pt;">org.docx4j.openpackaging.parts.WordprocessingML</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">.ImageJpegPart] </span></span></p>576 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">Part /word/media/image1.jpeg [</span><span style="color: #000000;font-size: 7.0pt;">org.docx4j.openpackaging.parts.WordprocessingML</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">.ImageJpegPart] </span></span></p> 590 577 591 578 <p class="Normal DocDefaults " /> … … 595 582 <p class="Normal DocDefaults ">on the package:</p> 596 583 597 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span></p>598 599 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> MainDocumentPart getMainDocumentPart() </span></span></p>600 601 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 602 603 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocPropsCorePart getDocPropsCorePart() </span></span></p>604 605 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocPropsExtendedPart getDocPropsExtendedPart() </span></span></p>606 607 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocPropsCustomPart getDocPropsCustomPart() </span></span></p>584 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span></p> 585 586 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> MainDocumentPart getMainDocumentPart() </span></span></p> 587 588 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 589 590 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocPropsCorePart getDocPropsCorePart() </span></span></p> 591 592 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocPropsExtendedPart getDocPropsExtendedPart() </span></span></p> 593 594 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocPropsCustomPart getDocPropsCustomPart() </span></span></p> 608 595 609 596 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 611 598 <p class="Normal DocDefaults ">on the document part:</p> 612 599 613 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> StyleDefinitionsPart getStyleDefinitionsPart()</span></span></p>614 615 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> NumberingDefinitionsPart getNumberingDefinitionsPart()</span></span></p>616 617 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> ThemePart getThemePart()</span></span></p>618 619 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> FontTablePart getFontTablePart()</span></span></p>620 621 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 622 623 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> CommentsPart getCommentsPart()</span></span></p>624 625 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 626 627 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> EndnotesPart getEndNotesPart()</span></span></p>628 629 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> FootnotesPart getFootnotesPart()</span></span></p>630 631 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 632 633 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocumentSettingsPart getDocumentSettingsPart()</span></span></p>634 635 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> WebSettingsPart getWebSettingsPart()</span></span></p>600 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> StyleDefinitionsPart getStyleDefinitionsPart()</span></span></p> 601 602 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> NumberingDefinitionsPart getNumberingDefinitionsPart()</span></span></p> 603 604 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> ThemePart getThemePart()</span></span></p> 605 606 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> FontTablePart getFontTablePart()</span></span></p> 607 608 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 609 610 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> CommentsPart getCommentsPart()</span></span></p> 611 612 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 613 614 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> EndnotesPart getEndNotesPart()</span></span></p> 615 616 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> FootnotesPart getFootnotesPart()</span></span></p> 617 618 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 619 620 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> DocumentSettingsPart getDocumentSettingsPart()</span></span></p> 621 622 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> WebSettingsPart getWebSettingsPart()</span></span></p> 636 623 637 624 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 639 626 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">If a part points to any other parts, it will have a relationships part listing these other parts. </span></p> 640 627 641 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   RelationshipsPart rp = part.getRelationshipsPart();</span></p>628 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   RelationshipsPart rp = part.getRelationshipsPart();</span></p> 642 629 643 630 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 645 632 <p class="Normal DocDefaults ">You can access those, and from there, get the part you want:</p> 646 633 647 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">for</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> ( Relationship r : rp.getRelationships().getRelationship() ) {</span></span></p>648 649 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span></p>650 651 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #0000C0;font-style: italic;font-family: Courier New;font-size: 8.0pt;">log</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">.info(</span><span style="color: #2A00FF;font-family: Courier New;font-size: 8.0pt;">"\nFor Relationship Id="</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + r.getId() </span></span></p>652 653 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">+ </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 8.0pt;">" Source is "</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + rp.getSourceP().getPartName() </span></span></p>654 655 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">+ </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 8.0pt;">", Target is "</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + r.getTarget() </span></span></p>656 657 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">+ </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 8.0pt;">" type "</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + r.getType() + </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 8.0pt;">"\n"</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">);</span></p>658 659 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span></p>660 661 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   Part part = rp.getPart(r);</span></p>662 663 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   }</span></p>664 665 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span></p>634 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">for</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> ( Relationship r : rp.getRelationships().getRelationship() ) {</span></span></p> 635 636 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span></p> 637 638 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #0000C0;font-style: italic;font-size: 8.0pt;">log</span><span style="color: #000000;font-size: 8.0pt;">.info(</span><span style="color: #2A00FF;font-size: 8.0pt;">"\nFor Relationship Id="</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + r.getId() </span></span></p> 639 640 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">+ </span></span><span style="color: #2A00FF;font-size: 8.0pt;">" Source is "</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + rp.getSourceP().getPartName() </span></span></p> 641 642 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">+ </span></span><span style="color: #2A00FF;font-size: 8.0pt;">", Target is "</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + r.getTarget() </span></span></p> 643 644 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">+ </span></span><span style="color: #2A00FF;font-size: 8.0pt;">" type "</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> + r.getType() + </span></span><span style="color: #2A00FF;font-size: 8.0pt;">"\n"</span><span style="color: #000000;font-size: 8.0pt;">);</span></p> 645 646 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span></p> 647 648 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   Part part = rp.getPart(r);</span></p> 649 650 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   }</span></p> 651 652 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span></p> 666 653 667 654 <p class="Normal DocDefaults " /> … … 671 658 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">There is also a list of </span><span style="font-weight: bold;">all</span><span style="white-space:pre-wrap;"> parts, in the package object:</span></p> 672 659 673 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;">   Parts parts = wordMLPackage.getParts();</span></p>660 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   Parts parts = wordMLPackage.getParts();</span></p> 674 661 675 662 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 681 668 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">To add a part, see the section </span>Adding a Part<span style="white-space:pre-wrap;"> below.</span></p> 682 669 683 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Samples</span></p>670 <p class="Heading1 Normal DocDefaults "><span>Samples</span></p> 684 671 685 672 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">The package org.docx4j.samples contains examples of how to do things with docx4j. There are pptx and xlsx samples in packages org.pptx4j.samples and org.xlsx4j.samples respectively.</p> … … 689 676 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Basics</p> 690 677 691 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CreateWordprocessingMLDocument</p>692 693 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>DisplayMainDocumentPartXml</p>694 695 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>OpenAndSaveRoundTripTest</p>696 697 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>OpenMainDocumentAndTraverse</p>698 699 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>XPathQuery (2010 07 13 nightly or later only)</p>678 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CreateWordprocessingMLDocument</p> 679 680 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>DisplayMainDocumentPartXml</p> 681 682 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>OpenAndSaveRoundTripTest</p> 683 684 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>OpenMainDocumentAndTraverse</p> 685 686 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>XPathQuery (2010 07 13 nightly or later only)</p> 700 687 701 688 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Output/Transformation</p> 702 689 703 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CreateHtml</p>704 705 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CreatePdf</p>690 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CreateHtml</p> 691 692 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CreatePdf</p> 706 693 707 694 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">Flat OPC XML </span></p> 708 695 709 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>ExportInPackageFormat</p>710 711 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>ImportFromPackageFormat</p>696 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>ExportInPackageFormat</p> 697 698 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>ImportFromPackageFormat</p> 712 699 713 700 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">Image handling </span></p> 714 701 715 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>AddImage</p>716 717 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>ConvertEmbeddedImageToLinked</p>702 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>AddImage</p> 703 704 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>ConvertEmbeddedImageToLinked</p> 718 705 719 706 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Part Handling</p> 720 707 721 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CopyPart</p>722 723 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>ImportForeignPart</p>724 725 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>PartsList</p>726 727 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>StripParts</p>708 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CopyPart</p> 709 710 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>ImportForeignPart</p> 711 712 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>PartsList</p> 713 714 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>StripParts</p> 728 715 729 716 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Document generation/document assembly using content controls</p> 730 717 731 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>AltChunk</p>732 733 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CreateDocxWithCustomXml</p>734 735 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CustomXmlBinding</p>736 737 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>ContentControlBindingExtensions</p>718 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>AltChunk</p> 719 720 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CreateDocxWithCustomXml</p> 721 722 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CustomXmlBinding</p> 723 724 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>ContentControlBindingExtensions</p> 738 725 739 726 <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Miscellaneous</p> 740 727 741 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>CompareDocuments</p>742 743 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>DocProps</p>744 745 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>Filter</p>746 747 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>HyperlinkTest</p>748 749 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>NumberingRestart</p>750 751 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>UnmarshallFromTemplate</p>728 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>CompareDocuments</p> 729 730 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>DocProps</p> 731 732 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>Filter</p> 733 734 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>HyperlinkTest</p> 735 736 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>NumberingRestart</p> 737 738 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>UnmarshallFromTemplate</p> 752 739 753 740 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">If you installed the source code, you'll have this package already.</p> … … 763 750 <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;space-after: 0in;line-height: 100%;" /> 764 751 765 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Creating a new docx</span></p>752 <p class="Heading1 Normal DocDefaults "><span>Creating a new docx</span></p> 766 753 767 754 <p class="Normal DocDefaults " style="space-after: 0.07in;line-height: 100%;">To create a new docx:</p> 768 755 769 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create the package</span></p>770 771 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();</span></p>772 773 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 774 775 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Save it</span></p>776 777 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-family: Consolas;font-size: 9.0pt;">wordMLPackage.save(new java.io.File("helloworld.docx") );</span></p>756 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create the package</span></p> 757 758 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();</span></p> 759 760 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 761 762 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Save it</span></p> 763 764 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-size: 9.0pt;">wordMLPackage.save(new java.io.File("helloworld.docx") );</span></p> 778 765 779 766 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">That's it. </span></p> 780 767 781 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">createPackage() </span></span>is a convenience method, which does:</p>782 783 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create the package</span></p>784 785 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">WordprocessingMLPackage wordMLPackage = new WordprocessingMLPackage();</span></p>786 787 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 788 789 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create the main document part (word/document.xml)</span></p>790 791 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-family: Consolas;font-size: 9.0pt;">MainDocumentPart wordDocumentPart = new MainDocumentPart();</span></p>792 793 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 794 795 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create main document part content</span></p>796 797 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">ObjectFactory factory = Context.getWmlObjectFactory();</span></p>798 799 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.Body body = factory .createBody();</span></p>800 801 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.Document wmlDocumentEl = factory .createDocument();</span></p>802 803 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">wmlDocumentEl.setBody(body);</span></p>804 805 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>806 807 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Put the content in the part</span></p>808 809 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">wordDocumentPart.setJaxbElement(wmlDocumentEl);</span></p>810 811 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>812 813 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Add the main document part to the package relationships</span></p>814 815 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// (creating it if necessary)</span></p>816 817 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">wmlPack.addTargetPart(wordDocumentPart);</span></p>768 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">createPackage() </span></span>is a convenience method, which does:</p> 769 770 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create the package</span></p> 771 772 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">WordprocessingMLPackage wordMLPackage = new WordprocessingMLPackage();</span></p> 773 774 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 775 776 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create the main document part (word/document.xml)</span></p> 777 778 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-size: 9.0pt;">MainDocumentPart wordDocumentPart = new MainDocumentPart();</span></p> 779 780 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 781 782 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create main document part content</span></p> 783 784 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">ObjectFactory factory = Context.getWmlObjectFactory();</span></p> 785 786 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Body body = factory .createBody();</span></p> 787 788 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Document wmlDocumentEl = factory .createDocument();</span></p> 789 790 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">wmlDocumentEl.setBody(body);</span></p> 791 792 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 793 794 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Put the content in the part</span></p> 795 796 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">wordDocumentPart.setJaxbElement(wmlDocumentEl);</span></p> 797 798 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 799 800 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Add the main document part to the package relationships</span></p> 801 802 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// (creating it if necessary)</span></p> 803 804 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">wmlPack.addTargetPart(wordDocumentPart);</span></p> 818 805 819 806 <p class="Heading1 Normal DocDefaults "><a name="_Ref273525601" />Adding a paragraph of text</p> 820 807 821 <p class="Normal DocDefaults "><span style="font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">MainDocumentPart </span></span>contains a method:</p>822 823 <p class="Normal DocDefaults "><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.P addStyledParagraphOfText(String styleId, String text)</span></p>808 <p class="Normal DocDefaults "><span style="font-size: 9.0pt;"><span style="white-space:pre-wrap;">MainDocumentPart </span></span>contains a method:</p> 809 810 <p class="Normal DocDefaults "><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.P addStyledParagraphOfText(String styleId, String text)</span></p> 824 811 825 812 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">You can use that method to add a paragraph using the specified style.</p> … … 827 814 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">The XML we are looking to create will be something like:</p> 828 815 829 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font- family: Consolas;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;"><span style="white-space:pre-wrap;">w:p </span></span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-family: Consolas;font-size: 8.5pt;">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">        </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span></p>830 831 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">addStyledParagraphOfText </span></span>builds the object structure âthe JAXB wayâ, and adds it to the document.</p>832 833 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">ObjectFactory factory = Context.getWmlObjectFactory();</span></p>834 835 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 836 837 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create the paragraph</span></p>838 839 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.P para = factory.createP();</span></p>840 841 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 842 843 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create the text element</span></p>844 845 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.Text t = factory.createText();</span></p>846 847 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">t.setValue(simpleText);</span></p>848 849 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>850 851 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create the run</span></p>852 853 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.R run = factory.createR();</span></p>854 855 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">run.getRunContent().add(t); </span></span></p>856 857 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>858 859 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">para.getParagraphContent().add(run);</span></p>860 861 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 862 863 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Now add our paragraph to the document body</span></p>864 865 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">Body body = this.jaxbElement.getBody();</span></p>866 867 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">Body.getEGBlockLevelElts().add(para)</span></p>816 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;"><span style="white-space:pre-wrap;">w:p </span></span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-size: 8.5pt;">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">        </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span></p> 817 818 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">addStyledParagraphOfText </span></span>builds the object structure âthe JAXB wayâ, and adds it to the document.</p> 819 820 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">ObjectFactory factory = Context.getWmlObjectFactory();</span></p> 821 822 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 823 824 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create the paragraph</span></p> 825 826 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.P para = factory.createP();</span></p> 827 828 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 829 830 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create the text element</span></p> 831 832 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Text t = factory.createText();</span></p> 833 834 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">t.setValue(simpleText);</span></p> 835 836 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 837 838 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create the run</span></p> 839 840 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.R run = factory.createR();</span></p> 841 842 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">run.getRunContent().add(t); </span></span></p> 843 844 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 845 846 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">para.getParagraphContent().add(run);</span></p> 847 848 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 849 850 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Now add our paragraph to the document body</span></p> 851 852 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">Body body = this.jaxbElement.getBody();</span></p> 853 854 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">Body.getEGBlockLevelElts().add(para)</span></p> 868 855 869 856 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Notice that adding a paragraph involves:</p> 870 857 871 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">Body.getEGBlockLevelElts().add(para)</span></p>858 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">Body.getEGBlockLevelElts().add(para)</span></p> 872 859 873 860 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Similarly, the paragraph object P has:</p> 874 861 875 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="font-weight: bold;color: #7F0055;font- family: Courier New;font-size: 9.0pt;">   public</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> List<Object> getParagraphContent()</span></span></p>876 877 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000; font-family: Calibri;">and the run object:</span></p>878 879 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font-weight: bold;color: #7F0055;font- family: Courier New;font-size: 9.0pt;">   public</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> List<Object> getRunContent() </span></span></p>862 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;">   public</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> List<Object> getParagraphContent()</span></span></p> 863 864 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;">and the run object:</span></p> 865 866 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;">   public</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> List<Object> getRunContent() </span></span></p> 880 867 881 868 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Alternatively, you can create the paragraph by marshalling XML:</p> 882 869 883 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Assuming String xml contains the XML above</span></p>884 885 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.P para = XmlUtils.unmarshalString(xml);</span></p>870 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Assuming String xml contains the XML above</span></p> 871 872 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.P para = XmlUtils.unmarshalString(xml);</span></p> 886 873 887 874 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">For this to work, you need to ensure that all namespaces are declared properly in the string.</p> … … 889 876 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">See further below for adding images, and tables.</p> 890 877 891 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Traversing a document</span></p>878 <p class="Heading1 Normal DocDefaults "><span>Traversing a document</span></p> 892 879 893 880 <p class="Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/samples/OpenMainDocumentAndTraverse.java"><span style="color: #0000FF;text-decoration: none;">OpenMainDocumentAndTraverse.java</span></a><span style="white-space:pre-wrap;"> in the samples directory shows you how to traverse the JAXB representation of a docx. </span></p> … … 895 882 <p class="Normal DocDefaults ">You can run it from a command line:</p> 896 883 897 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Courier New;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.OpenMainDocumentAndTraverse [input.docx]</span></p>898 899 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Trebuchet MS;font-size: 8.0pt;">If there are any images in the docx, you'd also need to add to your classpath: xmlgraphics-commons-1.4.jar and commons-logging-1.1.1.jar</span></p>884 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.OpenMainDocumentAndTraverse [input.docx]</span></p> 885 886 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">If there are any images in the docx, you'd also need to add to your classpath: xmlgraphics-commons-1.4.jar and commons-logging-1.1.1.jar</span></p> 900 887 901 888 <p class="Normal DocDefaults ">This sample is useful if you want to see what objects are used in your document.xml.</p> … … 903 890 <p class="Normal DocDefaults ">This is an alternative to XSLT, which doesn't require marshalling/unmarshalling.</p> 904 891 905 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">The sample uses TraversalUtil, which is a general approach for traversing the JAXB object tree in the main document part. It can also be applied to headers, footers etc. TraversalUtil has an </span><span style="font-weight: bold;color: #7F0055;font- family: Consolas;font-size: 8.0pt;">interface</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> Callback, </span></span>which you use to specify how you want to traverse the nodes, and what you want to do to them.</p>906 907 <p class="Normal DocDefaults ">As noted in "Adding a paragraph of text<span style="white-space:pre-wrap;">" above, many objects (eg the document body, a paragraph, a run), have a List containing their content (see </span><span style="font-family: Calibri;">The ContentAccessor interface</span><span style="white-space:pre-wrap;"> further below). Traversal works by iterating over these lists. </span></p>908 909 <p class="Heading1 Normal DocDefaults "><a name="_Ref273526076" /><span style="font-family: Calibri;">General strategy/approach for creating stuff</span></p>892 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">The sample uses TraversalUtil, which is a general approach for traversing the JAXB object tree in the main document part. It can also be applied to headers, footers etc. TraversalUtil has an </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">interface</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> Callback, </span></span>which you use to specify how you want to traverse the nodes, and what you want to do to them.</p> 893 894 <p class="Normal DocDefaults ">As noted in "Adding a paragraph of text<span style="white-space:pre-wrap;">" above, many objects (eg the document body, a paragraph, a run), have a List containing their content (see </span><span>The ContentAccessor interface</span><span style="white-space:pre-wrap;"> further below). Traversal works by iterating over these lists. </span></p> 895 896 <p class="Heading1 Normal DocDefaults "><a name="_Ref273526076" /><span>General strategy/approach for creating stuff</span></p> 910 897 911 898 <p class="Normal DocDefaults ">The first thing you need to know is what the XML you are trying to create looks like.</p> … … 915 902 <p class="Normal DocDefaults ">Now look at its XML. Choices:</p> 916 903 917 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">You can unzip it to do this </span></p>918 919 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">easiest may be to save it as Flat OPC XML from Word (or use the </span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">ExportInPackageFormat</span><span style="white-space:pre-wrap;"> sample), so you have just a single XML file which you don't need to unzip</span></p>920 921 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">you can use the </span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">DisplayMainDocumentPartXml </span></span><span style="color: #000000;font-family: Calibri;">to get it</span></p>922 923 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="color: #000000;font-family: Calibri;">you can open it with docx4all, and look at the source view</span></p>924 925 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="color: #000000;font-family: Calibri;">on Windows, if you have Visual Studio 2010, you can drag the docx onto it</span></p>926 927 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="color: #000000;font-family: Calibri;">on Windows, get PackageExplorer from codeplex.</span></p>904 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">You can unzip it to do this </span></p> 905 906 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">easiest may be to save it as Flat OPC XML from Word (or use the </span><span style="color: #000000;font-size: 9.0pt;">ExportInPackageFormat</span><span style="white-space:pre-wrap;"> sample), so you have just a single XML file which you don't need to unzip</span></p> 907 908 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">you can use the </span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">DisplayMainDocumentPartXml </span></span><span style="color: #000000;">to get it</span></p> 909 910 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="color: #000000;">you can open it with docx4all, and look at the source view</span></p> 911 912 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="color: #000000;">on Windows, if you have Visual Studio 2010, you can drag the docx onto it</span></p> 913 914 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="color: #000000;">on Windows, get PackageExplorer from codeplex.</span></p> 928 915 929 916 <p class="Normal DocDefaults ">Now you are ready to create this XML using JAXB. There are 2 basic ways.</p> … … 931 918 <p class="Normal DocDefaults ">The classic JAXB way is to use the ObjectFactory's .createX methods. For example:</p> 932 919 933 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> ObjectFactory factory = Context.</span></span><span style="color: #000000;font-style: italic;font-family: Courier New;font-size: 9.0pt;">getWmlObjectFactory</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">();</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">   </span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"> </span></span></p>934 935 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> P p = factory.createP();</span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">   </span></p>920 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> ObjectFactory factory = Context.</span></span><span style="color: #000000;font-style: italic;font-size: 9.0pt;">getWmlObjectFactory</span><span style="color: #000000;font-size: 9.0pt;">();</span><span style="color: #000000;font-size: 9.0pt;">   </span><span style="color: #000000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"> </span></span></p> 921 922 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> P p = factory.createP();</span></span><span style="color: #000000;font-size: 9.0pt;">   </span></p> 936 923 937 924 <p class="Normal DocDefaults " /> 938 925 939 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">The challenge with this is to know what object it is you are trying to create. To find this out, run </span><span style="color: #000000;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">OpenMainDocumentAndTraverse </span></span>on your document.</p>926 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">The challenge with this is to know what object it is you are trying to create. To find this out, run </span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">OpenMainDocumentAndTraverse </span></span>on your document.</p> 940 927 941 928 <p class="Normal DocDefaults ">Here are the names for some common objects:</p> … … 945 932 <table class="TableGrid TableNormal " id="docx4j_tbl_2" style="position: relative; margin-left: 0.37in;table-layout: fixed;border-collapse: collapse;"><colgroup><col style="width: 0.98in;" /><col style="width: 0.89in;" /><col style="width: 1.66in;" /><col style="width: 40mm;" /></colgroup><tbody><tr style="vertical-align: top;"><td style="background-color: #D9D9D9;"> 946 933 947 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font- family: Calibri;font-size: 9.0pt;">Object</span></p></td><td style="background-color: #D9D9D9;">948 949 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font- family: Calibri;font-size: 9.0pt;">XML element</span></p></td><td style="background-color: #D9D9D9;">950 951 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font- family: Calibri;font-size: 9.0pt;">docx4j class</span></p></td><td style="background-color: #D9D9D9;">952 953 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font- family: Calibri;font-size: 9.0pt;">Factory method</span></p></td></tr><tr style="vertical-align: top;"><td>954 955 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Document body</span></p></td><td>956 957 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:body</span></p></td><td>958 959 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Body</span></p></td><td>960 961 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createBody();</span></p></td></tr><tr style="vertical-align: top;"><td>962 963 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Paragraph</span></p></td><td>964 965 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:p</span></p></td><td>966 967 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.P</span></p></td><td>968 969 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createP()</span></p></td></tr><tr style="vertical-align: top;"><td>970 971 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Paragraph props</span></p></td><td>972 973 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:pPr</span></p></td><td>974 975 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.PPr</span></p></td><td>976 977 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createPPr()</span></p></td></tr><tr style="vertical-align: top;"><td>978 979 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Run</span></p></td><td>980 981 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:r</span></p></td><td>982 983 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.R</span></p></td><td>984 985 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createR()</span></p></td></tr><tr style="vertical-align: top;"><td>986 987 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Run props</span></p></td><td>988 989 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:rPr</span></p></td><td>990 991 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.RPr</span></p></td><td>992 993 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createRPr()</span></p></td></tr><tr style="vertical-align: top;"><td>994 995 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Text</span></p></td><td>996 997 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:t</span></p></td><td>998 999 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Text</span></p></td><td>1000 1001 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createText()</span></p></td></tr><tr style="vertical-align: top;"><td>1002 1003 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Table</span></p></td><td>1004 1005 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:tbl</span></p></td><td>1006 1007 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Tbl</span></p></td><td>1008 1009 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createTbl()</span></p></td></tr><tr style="vertical-align: top;"><td>1010 1011 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Table row</span></p></td><td>1012 1013 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:tr</span></p></td><td>1014 1015 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Tr</span></p></td><td>1016 1017 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createTr()</span></p></td></tr><tr style="vertical-align: top;"><td>1018 1019 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Table cell</span></p></td><td>1020 1021 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:tc</span></p></td><td>1022 1023 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Tc</span></p></td><td>1024 1025 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createTc()</span></p></td></tr><tr style="vertical-align: top;"><td>1026 1027 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Drawing</span></p></td><td>1028 1029 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:drawing</span></p></td><td>1030 1031 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Drawing</span></p></td><td>1032 1033 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createDrawing()</span></p></td></tr><tr style="vertical-align: top;"><td>1034 1035 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">Page break</span></p></td><td>1036 1037 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">w:br</span></p></td><td>1038 1039 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.Br</span></p></td><td>1040 1041 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createBr()</span></p></td></tr><tr style="vertical-align: top;"><td>1042 1043 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Footnote </span></span><span style="color: #000000;font-family: Calibri;font-size: 9.0pt;"><br clear="all" />or endnote ref</span></p></td><td>1044 1045 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">?</span></p></td><td>1046 1047 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">org.docx4j.wml.CTFtnEdnRef</span></p></td><td>1048 1049 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 9.0pt;">factory.createCTFtnEdnRef()</span></p></td></tr></tbody></table>934 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font-size: 9.0pt;">Object</span></p></td><td style="background-color: #D9D9D9;"> 935 936 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font-size: 9.0pt;">XML element</span></p></td><td style="background-color: #D9D9D9;"> 937 938 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font-size: 9.0pt;">docx4j class</span></p></td><td style="background-color: #D9D9D9;"> 939 940 <p class="Normal DocDefaults "><span style="font-weight: bold;color: #000000;font-size: 9.0pt;">Factory method</span></p></td></tr><tr style="vertical-align: top;"><td> 941 942 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Document body</span></p></td><td> 943 944 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:body</span></p></td><td> 945 946 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Body</span></p></td><td> 947 948 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createBody();</span></p></td></tr><tr style="vertical-align: top;"><td> 949 950 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Paragraph</span></p></td><td> 951 952 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:p</span></p></td><td> 953 954 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.P</span></p></td><td> 955 956 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createP()</span></p></td></tr><tr style="vertical-align: top;"><td> 957 958 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Paragraph props</span></p></td><td> 959 960 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:pPr</span></p></td><td> 961 962 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.PPr</span></p></td><td> 963 964 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createPPr()</span></p></td></tr><tr style="vertical-align: top;"><td> 965 966 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Run</span></p></td><td> 967 968 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:r</span></p></td><td> 969 970 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.R</span></p></td><td> 971 972 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createR()</span></p></td></tr><tr style="vertical-align: top;"><td> 973 974 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Run props</span></p></td><td> 975 976 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:rPr</span></p></td><td> 977 978 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.RPr</span></p></td><td> 979 980 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createRPr()</span></p></td></tr><tr style="vertical-align: top;"><td> 981 982 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Text</span></p></td><td> 983 984 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:t</span></p></td><td> 985 986 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Text</span></p></td><td> 987 988 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createText()</span></p></td></tr><tr style="vertical-align: top;"><td> 989 990 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Table</span></p></td><td> 991 992 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:tbl</span></p></td><td> 993 994 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Tbl</span></p></td><td> 995 996 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createTbl()</span></p></td></tr><tr style="vertical-align: top;"><td> 997 998 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Table row</span></p></td><td> 999 1000 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:tr</span></p></td><td> 1001 1002 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Tr</span></p></td><td> 1003 1004 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createTr()</span></p></td></tr><tr style="vertical-align: top;"><td> 1005 1006 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Table cell</span></p></td><td> 1007 1008 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:tc</span></p></td><td> 1009 1010 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Tc</span></p></td><td> 1011 1012 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createTc()</span></p></td></tr><tr style="vertical-align: top;"><td> 1013 1014 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Drawing</span></p></td><td> 1015 1016 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:drawing</span></p></td><td> 1017 1018 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Drawing</span></p></td><td> 1019 1020 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createDrawing()</span></p></td></tr><tr style="vertical-align: top;"><td> 1021 1022 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">Page break</span></p></td><td> 1023 1024 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">w:br</span></p></td><td> 1025 1026 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Br</span></p></td><td> 1027 1028 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createBr()</span></p></td></tr><tr style="vertical-align: top;"><td> 1029 1030 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Footnote </span></span><span style="color: #000000;font-size: 9.0pt;"><br clear="all" />or endnote ref</span></p></td><td> 1031 1032 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">?</span></p></td><td> 1033 1034 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.CTFtnEdnRef</span></p></td><td> 1035 1036 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 9.0pt;">factory.createCTFtnEdnRef()</span></p></td></tr></tbody></table> 1050 1037 1051 1038 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;"> </span></p> … … 1055 1042 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">For example, given:</p> 1056 1043 1057 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font- family: Consolas;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;"><span style="white-space:pre-wrap;">w:p </span></span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-family: Consolas;font-size: 8.5pt;">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">        </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span><span style="color: #000000;font-family: Consolas;font-size: 8.5pt;"><br clear="all" /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-family: Consolas;font-size: 8.5pt;">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-family: Consolas;font-size: 8.5pt;">></span></p>1044 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;"><span style="white-space:pre-wrap;">w:p </span></span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-size: 8.5pt;">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">        </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"><</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;">    </span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;"></</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;">></span></p> 1058 1045 1059 1046 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">you can simply:</p> 1060 1047 1061 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Assuming String xml contains the XML above</span></p>1062 1063 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.P para = XmlUtils.unmarshalString(xml);</span></p>1048 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Assuming String xml contains the XML above</span></p> 1049 1050 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.P para = XmlUtils.unmarshalString(xml);</span></p> 1064 1051 1065 1052 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 1069 1056 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">If you need to be explicit about the type, you can use:</p> 1070 1057 1071 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 9.0pt;">Object unmarshalString(String str, JAXBContext jc, Class declaredType)</span></p>1072 1073 <p class="Heading1 Normal DocDefaults "><a name="_Ref290751180" /><span style="font-family: Calibri;">The ContentAccessor interface</span></p>1058 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;">Object unmarshalString(String str, JAXBContext jc, Class declaredType)</span></p> 1059 1060 <p class="Heading1 Normal DocDefaults "><a name="_Ref290751180" /><span>The ContentAccessor interface</span></p> 1074 1061 1075 1062 <p class="Normal DocDefaults ">The forthcoming docx4j 2.7.0 (and current svn and nightly builds) introduces a content accessor interface.</p> … … 1077 1064 <p class="Normal DocDefaults ">This interface contains a single method:</p> 1078 1065 1079 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 10.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> List<Object> getContent();</span></span></p>1066 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 10.0pt;">public</span><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> List<Object> getContent();</span></span></p> 1080 1067 1081 1068 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 1137 1124 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">w:sdt</span></p></td><td> 1138 1125 1139 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">content controls; see the method</span><span style="color: #000000;font- family: Courier New;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> getSdtContent()</span></span></p></td></tr></tbody></table>1126 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">content controls; see the method</span><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> getSdtContent()</span></span></p></td></tr></tbody></table> 1140 1127 1141 1128 <p class="Normal DocDefaults " /> … … 1147 1134 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">Body</span></p></td><td> 1148 1135 1149 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getEGBlockLevelElts()</span></p></td></tr><tr style="vertical-align: top;"><td>1136 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getEGBlockLevelElts()</span></p></td></tr><tr style="vertical-align: top;"><td> 1150 1137 1151 1138 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">P</span></p></td><td> 1152 1139 1153 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getParagraphContent()</span></p></td></tr><tr style="vertical-align: top;"><td>1140 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getParagraphContent()</span></p></td></tr><tr style="vertical-align: top;"><td> 1154 1141 1155 1142 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">R</span></p></td><td> 1156 1143 1157 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getRunContent()</span></p></td></tr><tr style="vertical-align: top;"><td>1144 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getRunContent()</span></p></td></tr><tr style="vertical-align: top;"><td> 1158 1145 1159 1146 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">Tbl</span></p> … … 1163 1150 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">Tc</span></p></td><td> 1164 1151 1165 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getEGContentRowContent()</span></p>1166 1167 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getEGContentCellContent()</span></p>1168 1169 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getEGBlockLevelElts()</span></p></td></tr><tr style="vertical-align: top;"><td>1152 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getEGContentRowContent()</span></p> 1153 1154 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getEGContentCellContent()</span></p> 1155 1156 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getEGBlockLevelElts()</span></p></td></tr><tr style="vertical-align: top;"><td> 1170 1157 1171 1158 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">SdtBlock</span></p> … … 1177 1164 <p class="Normal DocDefaults "><span style="font-size: 10.0pt;">CTSdtCell</span></p></td><td> 1178 1165 1179 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getSdtContent().getEGContentBlockContent()</span></p>1180 1181 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getSdtContent().getParagraphContent()</span></p>1182 1183 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getSdtContent().getEGContentRowContent()</span></p>1184 1185 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font- family: Consolas;font-size: 10.0pt;">getSdtContent().getEGContentCellContent()</span></p></td></tr></tbody></table>1166 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getSdtContent().getEGContentBlockContent()</span></p> 1167 1168 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getSdtContent().getParagraphContent()</span></p> 1169 1170 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getSdtContent().getEGContentRowContent()</span></p> 1171 1172 <p class="Normal DocDefaults " style="space-after: 0mm;"><span style="color: #000000;font-size: 10.0pt;">getSdtContent().getEGContentCellContent()</span></p></td></tr></tbody></table> 1186 1173 1187 1174 <p class="Normal DocDefaults " /> 1188 1175 1189 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Creating and adding a table</span></p>1176 <p class="Heading1 Normal DocDefaults "><span>Creating and adding a table</span></p> 1190 1177 1191 1178 <p class="Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/model/table/TblFactory.java">org.docx4j.model.table.TblFactory</a><span style="white-space:pre-wrap;"> provides an easy way to create a simple table. For an example of its use, see the </span><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/samples/CreateWordprocessingMLDocument.java">CreateWordprocessingMLDocument sample</a>.</p> … … 1193 1180 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">If you want to know what you need to add to format your table (make it prettier), see </span><span style="white-space:pre-wrap;"> above.</span></p> 1194 1181 1195 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;"><span style="white-space:pre-wrap;">Selecting your insertion/editing point; </span></span><span style="font-family: Calibri;"><br clear="all" />accessing JAXB nodes via XPath</span></p>1182 <p class="Heading1 Normal DocDefaults "><span><span style="white-space:pre-wrap;">Selecting your insertion/editing point; </span></span><span><br clear="all" />accessing JAXB nodes via XPath</span></p> 1196 1183 1197 1184 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Sometimes, XPath is a succinct way to select the things you need to change.</p> … … 1199 1186 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Happily, from docx4j 2.<span style="font-weight: bold;">5</span>.0, you can do use XPath to select JAXB nodes:</p> 1200 1187 1201 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();</span></p>1202 1203 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">String xpath = </span></span><span style="color: #2A00FF;font-family: Consolas;font-size: 8.0pt;">"//w:p"</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">;</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span></p>1204 1205 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">List<Object> list = documentPart.getJAXBNodesViaXPath(xpath, </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 8.0pt;">false</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">);</span></p>1188 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();</span></p> 1189 1190 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">String xpath = </span></span><span style="color: #2A00FF;font-size: 8.0pt;">"//w:p"</span><span style="color: #000000;font-size: 8.0pt;">;</span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span></p> 1191 1192 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">List<Object> list = documentPart.getJAXBNodesViaXPath(xpath, </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">false</span><span style="color: #000000;font-size: 8.0pt;">);</span></p> 1206 1193 1207 1194 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">These JAXB nodes are live, in the sense that if you change them, your document changes.</p> 1208 1195 1209 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">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 </span><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">getJAXBNodesViaXPath</span>. Updating it again (with current JAXB 2.1.x or 2.2.x) will cause an error.</p>1196 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">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 </span><span style="color: #000000;font-size: 8.0pt;">getJAXBNodesViaXPath</span>. Updating it again (with current JAXB 2.1.x or 2.2.x) will cause an error.</p> 1210 1197 1211 1198 <p class="Heading1 Normal DocDefaults "><a name="_Ref275255216" />Adding a Part</p> … … 1213 1200 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">What if you wanted to add a new styles part? Here's how:</p> 1214 1201 1215 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Create a styles part</span></p>1216 1217 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">StyleDefinitionsPart stylesPart = </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">StyleDefinitionsPart();</span></p>1218 1219 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1220 1221 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Populate it with default styles</span></p>1222 1223 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">stylesPart.unmarshalDefaultStyles();</span></p>1224 1225 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>1226 1227 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Add the styles part to the main document part relationships</span></p>1228 1229 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">wordDocumentPart.addTargetPart(stylesPart);</span></p>1202 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Create a styles part</span></p> 1203 1204 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">StyleDefinitionsPart stylesPart = </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;">StyleDefinitionsPart();</span></p> 1205 1206 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1207 1208 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Populate it with default styles</span></p> 1209 1210 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">stylesPart.unmarshalDefaultStyles();</span></p> 1211 1212 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 1213 1214 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Add the styles part to the main document part relationships</span></p> 1215 1216 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">wordDocumentPart.addTargetPart(stylesPart);</span></p> 1230 1217 1231 1218 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">You'd take the same approach to add a header or footer.</p> … … 1233 1220 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">When you add a part this way, it is automatically added to the source part's relationships part.</p> 1234 1221 1235 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"> Generally, you'll also need to add a reference to the part (using its relationship id) to the Main Document Part. This applies to images, headers and footers. (Comments, footnotes and endnotes are abit different, in that what you add to the main document part are references to individual comments/footnotes/endnotes).</p>1236 1237 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">docx to (X)HTML</span></p>1222 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">Generally, you'll also need to add a reference to the part (using its relationship id) to the Main Document Part. This applies to images, headers and footers. (Comments, footnotes and endnotes are a </span>bit different, in that what you add to the main document part are references to individual comments/footnotes/endnotes).</p> 1223 1224 <p class="Heading1 Normal DocDefaults "><span>docx to (X)HTML</span></p> 1238 1225 1239 1226 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">docx4j uses XSLT to transform a docx to XHTML:</p> 1240 1227 1241 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">AbstractHtmlExporter exporter = </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">HtmlExporterNG2();</span></p>1242 1243 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Courier New;font-size: 9.0pt;">// note the *2* there</span></p>1244 1245 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1246 1247 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Write to StreamResult (in this case, an output stream)</span></p>1248 1249 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">OutputStream os = </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">java.io.FileOutputStream(inputfilepath + </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 9.0pt;">".html"</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">);</span></p>1250 1251 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>1252 1253 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">javax.xml.transform.stream.StreamResult result </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">= </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">javax.xml.transform.stream.StreamResult(os);</span></p>1254 1255 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1256 1257 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">exporter.html(wordMLPackage, result, </span></span></p>1258 1259 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">inputfilepath + </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 9.0pt;">"_files"</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">);</span></p>1228 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">AbstractHtmlExporter exporter = </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;">HtmlExporterNG2();</span></p> 1229 1230 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// note the *2* there</span></p> 1231 1232 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1233 1234 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Write to StreamResult (in this case, an output stream)</span></p> 1235 1236 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">OutputStream os = </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">java.io.FileOutputStream(inputfilepath + </span></span><span style="color: #2A00FF;font-size: 9.0pt;">".html"</span><span style="color: #000000;font-size: 9.0pt;">);</span></p> 1237 1238 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 1239 1240 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">javax.xml.transform.stream.StreamResult result </span></span><span style="color: #000000;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">= </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;">javax.xml.transform.stream.StreamResult(os);</span></p> 1241 1242 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1243 1244 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">exporter.html(wordMLPackage, result, </span></span></p> 1245 1246 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">inputfilepath + </span></span><span style="color: #2A00FF;font-size: 9.0pt;">"_files"</span><span style="color: #000000;font-size: 9.0pt;">);</span></p> 1260 1247 1261 1248 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">You will find the generated HTML is clean.</p> … … 1263 1250 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">Docx4j uses Java XSLT extension functions to do the heavy lifting, so the XSLT itself is kept simple.</p> 1264 1251 1265 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">If you have log4j debug level logging enabled for </span><span style="font-weight: bold;font- family: Consolas;font-size: 9.0pt;">org.docx4j.convert.out.html.HtmlExporterNG2</span><span style="white-space:pre-wrap;">, anything which is not implemented will be obvious in the output document. </span><span style="font-weight: bold;font-style: italic;">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p>1266 1267 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">The XSLT can be found at </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/main/java/org/docx4j/convert/out/html/docx2xhtmlNG2.xslt"><span class="Hyperlink DefaultParagraphFont " style="font- family: Consolas;font-size: 10.0pt;">src/main/java/org/docx4j/convert/out/html/docx2xhtmlNG2.xslt</span></a></p>1268 1269 <p class="normal0 Normal DocDefaults " style="line-height: 75%;"><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;">There are several ways to customise the HTML output.</span></p>1270 1271 <p class="listparagraph0 Normal DocDefaults " style="position: relative; margin-left: 0.25in;line-height: 75%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;">one of course is to alter the xslt itself. This should be avoided, unless your objective is to improve the fidelity of the output (in which case, please contribute a patch!)</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /><span style="white-space:pre-wrap;">To substitute your own XSLT, you can use the </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;">HtmlExporterNG2 </span></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;">method:</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">public</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">static</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">void</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> setXslt(Templates xslt)</span></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span></p>1272 1273 <p class="listparagraph0 Normal DocDefaults " style="position: relative; margin-left: 0.25in;line-height: 75%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><span style="white-space:pre-wrap;">another possibility (currently in svn trunk only) is to register an </span></span><span style="font-weight: bold;color: #000000;font-family: Calibri;font-size: 11.0pt;">SdtTagHandler</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;">.</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /><span style="white-space:pre-wrap;">An SdtTagHandler allows you to wrap SdtContent (Content Control content) in arbitrary HTML (for </span></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;">example, a <div> with a particular class attribute, or style attribute, or associated javascript).</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" />The design envisages different tag handlers being applied depending on the value of w:sdt/w:sdtPr/w:tag (hence the name tag handler). The content of a tag should be name/value pairs delimited like a URL query string.</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><br clear="all" />For further details, please see the SdtWriter class.</span></p>1252 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">If you have log4j debug level logging enabled for </span><span style="font-weight: bold;font-size: 9.0pt;">org.docx4j.convert.out.html.HtmlExporterNG2</span><span style="white-space:pre-wrap;">, anything which is not implemented will be obvious in the output document. </span><span style="font-weight: bold;font-style: italic;">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p> 1253 1254 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">The XSLT can be found at </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/main/java/org/docx4j/convert/out/html/docx2xhtmlNG2.xslt"><span class="Hyperlink DefaultParagraphFont " style="font-size: 10.0pt;">src/main/java/org/docx4j/convert/out/html/docx2xhtmlNG2.xslt</span></a></p> 1255 1256 <p class="normal0 Normal DocDefaults " style="line-height: 75%;"><span style="color: #000000;font-size: 11.0pt;">There are several ways to customise the HTML output.</span></p> 1257 1258 <p class="listparagraph0 Normal DocDefaults " style="position: relative; margin-left: 0.25in;line-height: 75%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="color: #000000;font-size: 11.0pt;">one of course is to alter the xslt itself. This should be avoided, unless your objective is to improve the fidelity of the output (in which case, please contribute a patch!)</span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /><span style="white-space:pre-wrap;">To substitute your own XSLT, you can use the </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">HtmlExporterNG2 </span></span><span style="color: #000000;font-size: 11.0pt;">method:</span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">public</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">static</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">void</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> setXslt(Templates xslt)</span></span><span style="color: #000000;font-size: 11.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span></p> 1259 1260 <p class="listparagraph0 Normal DocDefaults " style="position: relative; margin-left: 0.25in;line-height: 75%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="color: #000000;font-size: 11.0pt;"><span style="white-space:pre-wrap;">another possibility (currently in svn trunk only) is to register an </span></span><span style="font-weight: bold;color: #000000;font-size: 11.0pt;">SdtTagHandler</span><span style="color: #000000;font-size: 11.0pt;">.</span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" />An SdtTagHandler allows you to wrap SdtContent (Content Control content) in arbitrary HTML (for example, a <div> with a particular class attribute, or style attribute, or associated javascript).</span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" />The design envisages different tag handlers being applied depending on the value of w:sdt/w:sdtPr/w:tag (hence the name tag handler). The content of a tag should be name/value pairs delimited like a URL query string.</span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" /></span><span style="color: #000000;font-size: 11.0pt;"><br clear="all" />For further details, please see the SdtWriter class.</span></p> 1274 1261 1275 1262 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;" /> 1276 1263 1277 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">docx to PDF</span></p>1264 <p class="Heading1 Normal DocDefaults "><span>docx to PDF</span></p> 1278 1265 1279 1266 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">docx4j produces XSL FO, which can in turn be used to create a PDF.</p> … … 1283 1270 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">To create a PDF:</p> 1284 1271 1285 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Fonts identity mapping â best on Microsoft Windows</span></p>1286 1287 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">wordMLPackage.setFontMapper(</span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">IdentityPlusMapper());</span></p>1288 1289 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1290 1291 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Set up converter</span></p>1292 1293 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">org.docx4j.convert.out.pdf.PdfConversion c </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">= </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);</span></p>1294 1295 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1296 1297 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;">// Write to output stream</span></p>1298 1299 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">OutputStream os = </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">java.io.FileOutputStream(inputfilepath + </span></span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;">".pdf"</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">); </span></span></p>1300 1301 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">c.output(os);</span></p>1272 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Fonts identity mapping â best on Microsoft Windows</span></p> 1273 1274 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">wordMLPackage.setFontMapper(</span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;">IdentityPlusMapper());</span></p> 1275 1276 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1277 1278 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Set up converter</span></p> 1279 1280 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">org.docx4j.convert.out.pdf.PdfConversion c </span></span><span style="color: #3F7F5F;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">= </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.convert.out.pdf.viaXSLFO.Conversion(wordMLPackage);</span></p> 1281 1282 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1283 1284 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;">// Write to output stream</span></p> 1285 1286 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">OutputStream os = </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">new </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">java.io.FileOutputStream(inputfilepath + </span></span><span style="color: #2A00FF;font-size: 9.0pt;">".pdf"</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">); </span></span></p> 1287 1288 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">c.output(os);</span></p> 1302 1289 1303 1290 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">See the CreatePdf sample.</p> 1304 1291 1305 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">If you have log4j debug level logging enabled for </span><span style="font-weight: bold;font- family: Consolas;font-size: 9.0pt;">org.docx4j.convert.out.pdf.viaXSLFO</span><span style="white-space:pre-wrap;">, anything which is not implemented will be obvious in the output document. In addition, the logs will contain the intermediate XSL FO for inspection. </span><span style="font-weight: bold;font-style: italic;">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p>1306 1307 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">The XSLT can be found at </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/main/java/org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt"><span style="white-space:pre-wrap;"> </span><span class="Hyperlink DefaultParagraphFont " style="font- family: Consolas;font-size: 10.0pt;">src/main/java/org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt</span></a></p>1292 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">If you have log4j debug level logging enabled for </span><span style="font-weight: bold;font-size: 9.0pt;">org.docx4j.convert.out.pdf.viaXSLFO</span><span style="white-space:pre-wrap;">, anything which is not implemented will be obvious in the output document. In addition, the logs will contain the intermediate XSL FO for inspection. </span><span style="font-weight: bold;font-style: italic;">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p> 1293 1294 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">The XSLT can be found at </span><a href="http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/main/java/org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt"><span style="white-space:pre-wrap;"> </span><span class="Hyperlink DefaultParagraphFont " style="font-size: 10.0pt;">src/main/java/org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt</span></a></p> 1308 1295 1309 1296 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;" /> 1310 1297 1311 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Fonts</span></p>1298 <p class="Heading1 Normal DocDefaults "><span>Fonts</span></p> 1312 1299 1313 1300 <p class="Normal DocDefaults ">When docx4j is used to create a PDF, it can only use fonts which are available to it.</p> … … 1315 1302 <p class="Normal DocDefaults ">These fonts come from 2 sources:</p> 1316 1303 1317 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>those installed on the computer</p>1318 1319 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>those embedded in the document</p>1320 1321 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Note that Word silently performs </span><span style="font-weight: bold;font-style: italic;">font substitution</span><span style="white-space:pre-wrap;">. When you open an existing document in Word, and select text in a particular font, the actual font you see on the screen won't be the font reported in the ribbon if it is not installed on your computer or embedded in the document. To see whether Word 2007 is substituting a font, go into Word Options > Advanced > Show Document Content and press the "Font Substitution" button. </span></p>1304 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>those installed on the computer</p> 1305 1306 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>those embedded in the document</p> 1307 1308 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Note that Word silently performs </span><span style="font-weight: bold;font-style: italic;">font substitution</span><span style="white-space:pre-wrap;">. When you open an existing document in Word, and select text in a particular font, the actual font you see on the screen won't be the font reported in the ribbon if it is not installed on your computer or embedded in the document. To see whether Word 2007 </span><span style="white-space:pre-wrap;">is substituting a font, go into Word Options > Advanced > Show Document Content and press the "Font Substitution" button. </span></p> 1322 1309 1323 1310 <p class="Normal DocDefaults ">Word's font substitution information is not available to docx4j. As a developer, you 3 options:</p> 1324 1311 1325 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>ensure the font is installed or embedded</p>1326 1327 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>tell docx4j which font to use instead, or</p>1328 1329 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>allow docx4j to fallback to a default font</p>1312 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>ensure the font is installed or embedded</p> 1313 1314 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>tell docx4j which font to use instead, or</p> 1315 1316 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>allow docx4j to fallback to a default font</p> 1330 1317 1331 1318 <p class="Normal DocDefaults ">To embed a font in a document, open it in Word on a computer which has the font installed (check no substitution is occuring), and go to Word Options > Save > Embed Fonts in File.</p> … … 1337 1324 <p class="Normal DocDefaults ">A font mapper contains Map<String, PhysicalFont>; to add a font mapping, as per the example in the CreatePdf sample:</p> 1338 1325 1339 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #3F7F5F;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">// Set up font </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 8.0pt;text-decoration: none;">mapper</span></p>1340 1341 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">Mapper fontMapper = </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 8.0pt;">new</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> IdentityPlusMapper();</span></span></p>1342 1343 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   wordMLPackage.setFontMapper(fontMapper);</span></p>1344 1345 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span></p>1346 1347 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #3F7F5F;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">// Example of mapping missing font Algerian to installed font Comic </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 8.0pt;text-decoration: none;">Sans</span><span style="color: #3F7F5F;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> MS</span></span></p>1348 1349 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   PhysicalFont font = PhysicalFonts.</span><span style="color: #000000;font-style: italic;font-family: Consolas;font-size: 8.0pt;">getPhysicalFonts</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">().get(</span><span style="color: #2A00FF;font-family: Consolas;font-size: 8.0pt;">"Comic Sans MS"</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">);</span></p>1350 1351 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   fontMapper.getFontMappings().put(</span><span style="color: #2A00FF;font-family: Consolas;font-size: 8.0pt;">"Algerian"</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">, font);</span></p>1326 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #3F7F5F;font-size: 8.0pt;"><span style="white-space:pre-wrap;">// Set up font </span></span><span style="color: #3F7F5F;font-size: 8.0pt;text-decoration: none;">mapper</span></p> 1327 1328 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">Mapper fontMapper = </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">new</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> IdentityPlusMapper();</span></span></p> 1329 1330 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   wordMLPackage.setFontMapper(fontMapper);</span></p> 1331 1332 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span></p> 1333 1334 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #3F7F5F;font-size: 8.0pt;"><span style="white-space:pre-wrap;">// Example of mapping missing font Algerian to installed font Comic </span></span><span style="color: #3F7F5F;font-size: 8.0pt;text-decoration: none;">Sans</span><span style="color: #3F7F5F;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> MS</span></span></p> 1335 1336 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   PhysicalFont font = PhysicalFonts.</span><span style="color: #000000;font-style: italic;font-size: 8.0pt;">getPhysicalFonts</span><span style="color: #000000;font-size: 8.0pt;">().get(</span><span style="color: #2A00FF;font-size: 8.0pt;">"Comic Sans MS"</span><span style="color: #000000;font-size: 8.0pt;">);</span></p> 1337 1338 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   fontMapper.getFontMappings().put(</span><span style="color: #2A00FF;font-size: 8.0pt;">"Algerian"</span><span style="color: #000000;font-size: 8.0pt;">, font);</span></p> 1352 1339 1353 1340 <p class="Normal DocDefaults " /> 1354 1341 1355 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">You'll see the font names if you configure log4j debug level logging for </span><span style="font-weight: bold;font- family: Consolas;font-size: 9.0pt;">org.docx4j.fonts.PhysicalFonts</span></p>1356 1357 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Image Handling</span></p>1342 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">You'll see the font names if you configure log4j debug level logging for </span><span style="font-weight: bold;font-size: 9.0pt;">org.docx4j.fonts.PhysicalFonts</span></p> 1343 1344 <p class="Heading1 Normal DocDefaults "><span>Image Handling</span></p> 1358 1345 1359 1346 <p class="Normal DocDefaults ">When you add an image to a document in Word 2007, it is generally added as a new Part (ie you'll find a part in the resulting docx, containing the image in base 64 format).</p> … … 1363 1350 <p class="Normal DocDefaults ">It is also possible to create a âlinkedâ image. In this case, the image is not embedded in the docx package, but rather, is referenced at its external location.</p> 1364 1351 1365 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j's </span><span style="font-weight: bold;color: #000000;font- family: Consolas;font-size: 10.0pt;">BinaryPartAbstractImage</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span>class contains methods to allow you to create both embedded and linked images (along with appropriate relationships).</p>1366 1367 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/**</span></p>1368 1369 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* Create an image part from the provided byte array, attach it to the </span></span></p>1370 1371 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* main document part, and return it.*/</span></p>1372 1373 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p>1374 1375 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;">byte</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">[] bytes) </span></span></p>1376 1377 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>1378 1379 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/**</span></p>1380 1381 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* Create an image part from the provided byte array, attach it to the source part</span></p>1382 1383 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* (eg the main document part, a header part etc), and return it.*/</span></p>1384 1385 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p>1386 1387 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Part sourcePart, </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;">byte</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">[] bytes) </span></span></p>1388 1389 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1390 1391 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/**</span></p>1392 1393 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* Create a linked image part, and attach it as a rel of the specified source part</span></p>1394 1395 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* (eg a header part)</span><span style="font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">*/</span></p>1396 1397 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">BinaryPartAbstractImage createLinkedImagePart(</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage, Part sourcePart, String fileurl) </span></span></p>1352 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j's </span><span style="font-weight: bold;color: #000000;font-size: 10.0pt;">BinaryPartAbstractImage</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span>class contains methods to allow you to create both embedded and linked images (along with appropriate relationships).</p> 1353 1354 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/**</span></p> 1355 1356 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* Create an image part from the provided byte array, attach it to the </span></span></p> 1357 1358 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* main document part, and return it.*/</span></p> 1359 1360 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p> 1361 1362 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;">byte</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">[] bytes) </span></span></p> 1363 1364 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 1365 1366 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/**</span></p> 1367 1368 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* Create an image part from the provided byte array, attach it to the source part</span></p> 1369 1370 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* (eg the main document part, a header part etc), and return it.*/</span></p> 1371 1372 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p> 1373 1374 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Part sourcePart, </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;">byte</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">[] bytes) </span></span></p> 1375 1376 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1377 1378 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/**</span></p> 1379 1380 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* Create a linked image part, and attach it as a rel of the specified source part</span></p> 1381 1382 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* (eg a header part)</span><span style="font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">*/</span></p> 1383 1384 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;">BinaryPartAbstractImage createLinkedImagePart(</span><span style="color: #000000;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage, Part sourcePart, String fileurl) </span></span></p> 1398 1385 1399 1386 <p class="Normal DocDefaults " /> … … 1401 1388 <p class="Normal DocDefaults ">For an image to appear in the document, there also needs to be appropriate XML in the main document part. This XML can take 2 basic forms:</p> 1402 1389 1403 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">the Word 2007 </span><span style="font-weight: bold;color: #800000;font-family: Consolas;">w:drawing</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span>form</p>1404 1405 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1406 1407 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;"><w:p></span></p>1408 1409 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <w:r></span></p>1410 1411 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <w:drawing></span></p>1412 1413 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><wp:inline </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">distT</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">distB</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">distL</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">distR</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="0"</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1414 1415 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><wp:extent </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">cx</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="3238500" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">cy</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="2362200" /</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1416 1417 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><wp:effectExtent </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">l</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="19050" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">t</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">r</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">b</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="0" /</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1418 1419 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   :</span></p>1420 1421 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <a:graphic ></span></p>1422 1423 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><a:graphicData </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> ..</span></span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1424 1425 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <pic:pic ></span></p>1426 1427 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   :</span></p>1428 1429 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <pic:blipFill></span></p>1430 1431 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="font-weight: bold;color: #800000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">a:blip </span></span><span style="font-weight: bold;color: #FF0000;font-family: Consolas;font-size: 9.0pt;">r:embed</span><span style="font-weight: bold;color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="rId5"</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> /</span></span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1432 1433 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   :</span></p>1434 1435 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">pic:blipFill></span></p>1436 1437 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   :</span></p>1438 1439 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">pic:pic></span></p>1440 1441 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">a:graphicData></span></p>1442 1443 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">a:graphic></span></p>1444 1445 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">wp:inline></span></p>1446 1447 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">w:drawing></span></p>1448 1449 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">w:r></span></p>1450 1451 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">w:p></span></p>1452 1453 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1454 1455 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">the Word 2003 VML-based </span><span style="font-weight: bold;color: #800000;font-family: Consolas;">w:pict</span><span style="white-space:pre-wrap;"> form</span></p>1456 1457 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;"><w:p></span></p>1458 1459 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <w:r></span></p>1460 1461 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <w:pict></span></p>1462 1463 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><v:shapetype </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">id</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="_x0000_t75" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">coordsize</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="21600,21600" </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> .. </span></span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1464 1465 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><v:stroke </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">joinstyle</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="miter" /</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1466 1467 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <v:formulas></span></p>1468 1469 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   :</span></p>1470 1471 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">v:formulas></span></p>1472 1473 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   :</span></p>1474 1475 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">v:shapetype></span></p>1476 1477 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><v:shape </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">..</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">style</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="width:428.25pt;height:321pt"</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1478 1479 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="font-weight: bold;color: #800000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">v:imagedata </span></span><span style="font-weight: bold;color: #FF0000;font-family: Consolas;font-size: 9.0pt;">r:id</span><span style="font-weight: bold;color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="rId4"</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 9.0pt;">o:title</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">="" /</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">></span></p>1480 1481 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 9.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;">v:shape></span></p>1482 1483 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font- family: Consolas;font-size: 12.0pt;">   </span><span style="font-family: Consolas;font-size: 12.0pt;">   </span><span style="font-family: Consolas;font-size: 12.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;"><</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:pict></span></p>1484 1485 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:r></span></p>1486 1487 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:p></span></p>1390 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">the Word 2007 </span><span style="font-weight: bold;color: #800000;">w:drawing</span><span style="color: #800000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span>form</p> 1391 1392 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1393 1394 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;"><w:p></span></p> 1395 1396 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <w:r></span></p> 1397 1398 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <w:drawing></span></p> 1399 1400 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><wp:inline </span></span><span style="color: #FF0000;font-size: 9.0pt;">distT</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-size: 9.0pt;">distB</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-size: 9.0pt;">distL</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-size: 9.0pt;">distR</span><span style="color: #0000FF;font-size: 9.0pt;">="0"</span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1401 1402 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><wp:extent </span></span><span style="color: #FF0000;font-size: 9.0pt;">cx</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="3238500" </span></span><span style="color: #FF0000;font-size: 9.0pt;">cy</span><span style="color: #0000FF;font-size: 9.0pt;">="2362200" /</span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1403 1404 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><wp:effectExtent </span></span><span style="color: #FF0000;font-size: 9.0pt;">l</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="19050" </span></span><span style="color: #FF0000;font-size: 9.0pt;">t</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-size: 9.0pt;">r</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="0" </span></span><span style="color: #FF0000;font-size: 9.0pt;">b</span><span style="color: #0000FF;font-size: 9.0pt;">="0" /</span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1405 1406 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   :</span></p> 1407 1408 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <a:graphic ></span></p> 1409 1410 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><a:graphicData </span></span><span style="color: #FF0000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> ..</span></span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1411 1412 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <pic:pic ></span></p> 1413 1414 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   :</span></p> 1415 1416 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <pic:blipFill></span></p> 1417 1418 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="font-weight: bold;color: #800000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">a:blip </span></span><span style="font-weight: bold;color: #FF0000;font-size: 9.0pt;">r:embed</span><span style="font-weight: bold;color: #0000FF;font-size: 9.0pt;">="rId5"</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> /</span></span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1419 1420 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   :</span></p> 1421 1422 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">pic:blipFill></span></p> 1423 1424 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   :</span></p> 1425 1426 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">pic:pic></span></p> 1427 1428 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">a:graphicData></span></p> 1429 1430 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">a:graphic></span></p> 1431 1432 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">wp:inline></span></p> 1433 1434 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">w:drawing></span></p> 1435 1436 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">w:r></span></p> 1437 1438 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">w:p></span></p> 1439 1440 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1441 1442 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">the Word 2003 VML-based </span><span style="font-weight: bold;color: #800000;">w:pict</span><span style="white-space:pre-wrap;"> form</span></p> 1443 1444 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;"><w:p></span></p> 1445 1446 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <w:r></span></p> 1447 1448 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <w:pict></span></p> 1449 1450 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><v:shapetype </span></span><span style="color: #FF0000;font-size: 9.0pt;">id</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="_x0000_t75" </span></span><span style="color: #FF0000;font-size: 9.0pt;">coordsize</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">="21600,21600" </span></span><span style="color: #FF0000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> .. </span></span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1451 1452 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><v:stroke </span></span><span style="color: #FF0000;font-size: 9.0pt;">joinstyle</span><span style="color: #0000FF;font-size: 9.0pt;">="miter" /</span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1453 1454 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <v:formulas></span></p> 1455 1456 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   :</span></p> 1457 1458 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">v:formulas></span></p> 1459 1460 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   :</span></p> 1461 1462 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">v:shapetype></span></p> 1463 1464 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <span style="white-space:pre-wrap;"><v:shape </span></span><span style="color: #FF0000;font-size: 9.0pt;">..</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-size: 9.0pt;">style</span><span style="color: #0000FF;font-size: 9.0pt;">="width:428.25pt;height:321pt"</span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1465 1466 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="font-weight: bold;color: #800000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">v:imagedata </span></span><span style="font-weight: bold;color: #FF0000;font-size: 9.0pt;">r:id</span><span style="font-weight: bold;color: #0000FF;font-size: 9.0pt;">="rId4"</span><span style="color: #0000FF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-size: 9.0pt;">o:title</span><span style="color: #0000FF;font-size: 9.0pt;">="" /</span><span style="color: #800000;font-size: 9.0pt;">></span></p> 1467 1468 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   </span><span style="color: #800000;font-size: 9.0pt;">   <</span><span style="color: #0000FF;font-size: 9.0pt;">/</span><span style="color: #800000;font-size: 9.0pt;">v:shape></span></p> 1469 1470 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font-size: 12.0pt;">   </span><span style="font-size: 12.0pt;">   </span><span style="font-size: 12.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;"><</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:pict></span></p> 1471 1472 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:r></span></p> 1473 1474 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:p></span></p> 1488 1475 1489 1476 <p class="Normal DocDefaults " /> 1490 1477 1491 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j can create the Word 2007 </span><span style="font-weight: bold;color: #800000; font-family: Consolas;">w:drawing/wp:inline</span><span style="color: #800000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span>form for you:</p>1492 1493 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/**</span></p>1494 1495 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* Create a </span></span><span style="color: #7F7F9F;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"><wp:inline> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">element suitable for this image,</span></p>1496 1497 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* which can be linked or embedded in w:p/w:r/w:drawing.</span></p>1498 1499 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* If the image is wider than the page, it will be scaled</span></p>1500 1501 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* automatically. See Javadoc for other signatures.</span></p>1502 1503 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">filenameHint Any text, for example the original filename</span></p>1504 1505 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">altText Like HTML's alt text</span></p>1506 1507 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">id1 An id unique in the document</span></p>1508 1509 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">id2 Another id unique in the document</span></p>1510 1511 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="font-weight: bold;color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">link</span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> true if this is to be </span></span><span style="font-weight: bold;color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">linked not embedded</span><span style="font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">*/</span></p>1512 1513 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Inline createImageInline(String filenameHint, String altText, </span></span></p>1514 1515 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">int </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">id1, </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">int </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">id2, </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">boolean </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">link) </span></span></p>1516 1517 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1518 1519 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">which you can then add to a </span><span style="font-weight: bold;color: #800000; font-family: Consolas;">w:r/w:drawing.</span></p>1478 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Docx4j can create the Word 2007 </span><span style="font-weight: bold;color: #800000;">w:drawing/wp:inline</span><span style="color: #800000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span>form for you:</p> 1479 1480 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/**</span></p> 1481 1482 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* Create a </span></span><span style="color: #7F7F9F;font-size: 9.0pt;"><span style="white-space:pre-wrap;"><wp:inline> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">element suitable for this image,</span></p> 1483 1484 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* which can be linked or embedded in w:p/w:r/w:drawing.</span></p> 1485 1486 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* If the image is wider than the page, it will be scaled</span></p> 1487 1488 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* automatically. See Javadoc for other signatures.</span></p> 1489 1490 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">filenameHint Any text, for example the original filename</span></p> 1491 1492 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">altText Like HTML's alt text</span></p> 1493 1494 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">id1 An id unique in the document</span></p> 1495 1496 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">id2 Another id unique in the document</span></p> 1497 1498 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">* </span></span><span style="color: #7F9FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">@param </span></span><span style="font-weight: bold;color: #3F5FBF;font-size: 9.0pt;">link</span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> true if this is to be </span></span><span style="font-weight: bold;color: #3F5FBF;font-size: 9.0pt;">linked not embedded</span><span style="font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">*/</span></p> 1499 1500 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Inline createImageInline(String filenameHint, String altText, </span></span></p> 1501 1502 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">int </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">id1, </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">int </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">id2, </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">boolean </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">link) </span></span></p> 1503 1504 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1505 1506 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">which you can then add to a </span><span style="font-weight: bold;color: #800000;">w:r/w:drawing.</span></p> 1520 1507 1521 1508 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Finally, with docx4j, you can convert images from formats unsupported by Word (eg PDF), to PNG, which is a supported format. For this, docx4j uses </span><span style="font-weight: bold;">ImageMagick</span>. So if you want to use this feature, you need to install ImageMagick. Docx4j invokes ImageMagick using:</p> 1522 1509 1523 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> Process p = Runtime.getRuntime().exec(</span></span><span style="color: #2A00FF;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">"imconvert -density " </span></span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">+ density + </span></span><span style="color: #2A00FF;font-family: Consolas;font-size: 8.0pt;">" -units PixelsPerInch - png:-"</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">);</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><br clear="all" /></span></p>1510 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> Process p = Runtime.getRuntime().exec(</span></span><span style="color: #2A00FF;font-size: 8.0pt;"><span style="white-space:pre-wrap;">"imconvert -density " </span></span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">+ density + </span></span><span style="color: #2A00FF;font-size: 8.0pt;">" -units PixelsPerInch - png:-"</span><span style="color: #000000;font-size: 8.0pt;">);</span><span style="color: #000000;font-size: 8.0pt;"><br clear="all" /></span></p> 1524 1511 1525 1512 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Note the name </span><span style="font-weight: bold;">imconvert</span><span style="white-space:pre-wrap;">, which is used so that we don't have to supply a full path to exec. You'll need to accommodate that. </span></p> 1526 1513 1527 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Manual Image Manipulation</span></p>1514 <p class="Heading1 Normal DocDefaults "><span>Manual Image Manipulation</span></p> 1528 1515 1529 1516 <p class="Normal DocDefaults ">Images involve three things:</p> 1530 1517 1531 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>the image part itself</p>1532 1533 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>a relationship, in the relationships part of the main document part (or header part etc). This relationship includes:</p>1534 1535 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.02in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Courier New;">o </span><span style="white-space:pre-wrap;">the name of the image part (for example, </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">/word/media/image1.jpeg</span>)</p>1536 1537 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.02in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Courier New;">o </span>the relationship ID</p>1538 1539 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">some XML in the main document part (or header part etc), referencing the relationship ID (see </span><span style="font-weight: bold;color: #800000;font-family: Consolas;">w:drawing</span><span style="white-space:pre-wrap;"> and </span><span style="font-weight: bold;color: #800000;font-family: Consolas;">w:pict</span><span style="white-space:pre-wrap;"> examples above)</span></p>1518 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>the image part itself</p> 1519 1520 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>a relationship, in the relationships part of the main document part (or header part etc). This relationship includes:</p> 1521 1522 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.02in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">o </span><span style="white-space:pre-wrap;">the name of the image part (for example, </span><span style="color: #000000;font-size: 8.0pt;">/word/media/image1.jpeg</span>)</p> 1523 1524 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 1.02in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">o </span>the relationship ID</p> 1525 1526 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">some XML in the main document part (or header part etc), referencing the relationship ID (see </span><span style="font-weight: bold;color: #800000;">w:drawing</span><span style="white-space:pre-wrap;"> and </span><span style="font-weight: bold;color: #800000;">w:pict</span><span style="white-space:pre-wrap;"> examples above)</span></p> 1540 1527 1541 1528 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">This means that if you are moving images around, you need to take care to ensure that the relationships remain valid. </span></p> … … 1545 1532 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Given an image part, you can get the relationship pointing to it </span></p> 1546 1533 1547 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">Relationship</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> rel = copiedImagePart.getSourceRelationship();</span></span></p>1548 1549 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   String id = rel.getId();</span></p>1534 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">Relationship</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> rel = copiedImagePart.getSourceRelationship();</span></span></p> 1535 1536 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   String id = rel.getId();</span></p> 1550 1537 1551 1538 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 1553 1540 <p class="Normal DocDefaults ">You can then ensure the reference matches.</p> 1554 1541 1555 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Adding Headers/Footers</span></p>1542 <p class="Heading1 Normal DocDefaults "><span>Adding Headers/Footers</span></p> 1556 1543 1557 1544 <p class="Normal DocDefaults ">See the HeaderFooter sample for how to do this.</p> 1558 1545 1559 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Merging Documents</span></p>1560 1561 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;">As</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Calibri;font-size: 11.0pt;"> </span><a href="http://blogs.msdn.com/b/ericwhite/archive/2008/11/03/inserting-deleting-moving-paragraphs-in-open-xml-wordprocessing-documents.aspx"><span class="Hyperlink DefaultParagraphFont " style="color: #AD582A;font-family: Calibri;font-size: 11.0pt;">Eric Whiteâs blog explained</span></a><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;">, combining multiple documents can be complicated:</span></p>1562 1563 <p class="NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="color: #777777;font- family: Calibri;font-size: 11.0pt;">This programming task is complicated by the need to keep other parts of the document in sync with the data stored in paragraphs. For example, a paragraph can contain a reference to a comment in the comments part, and if there is a problem with this reference, the document is invalid. You must take care when moving / inserting / deleting paragraphs to maintain â</span><span class="Emphasis DefaultParagraphFont " style="font-weight: bold;color: #777777;font-family: Calibri;font-size: 11.0pt;">referential integrity</span><span style="color: #777777;font-family: Calibri;font-size: 11.0pt;">â within the document.</span></p>1564 1565 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;">There is a paid extension for docx4j, called MergeDocx, which makes merging documents as easy as invoking the method:</span></p>1566 1567 <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font- family: Consolas;font-size: 8.0pt;">   public</span><span style="font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;">  </span></span><span class="HTMLCode DefaultParagraphFont " style="font-family: Consolas;font-size: 8.0pt;">WordprocessingMLPackage merge(List<WordprocessingMLPackage> wmlPkgs)</span></p>1568 1569 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;">In other words, you pass a list of docx, and get a single new docx back.</span></p>1570 1571 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;"><span style="white-space:pre-wrap;">The extension can also be used to process a </span></span><span style="font-weight: bold;color: #000000;font-family: Calibri;font-size: 11.0pt;">docx</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;"><span style="white-space:pre-wrap;"> which is embedded as an</span></span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-family: Calibri;font-size: 11.0pt;"> </span><span class="Strong DefaultParagraphFont " style="color: #000000;font-family: Calibri;font-size: 11.0pt;">altChunk</span><span style="color: #000000;font-family: Calibri;font-size: 11.0pt;">. (Without the extension, you have to rely on Word to convert the altChunk to normal content, which means if your docx contains w:altChunk, you have to round trip it through Word, before docx4j can create a PDF or HTML out of it.)</span></p>1572 1573 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;">To process the w:altChunk elements in a docx, you invoke:</span></p>1574 1575 <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font- family: Consolas;font-size: 8.0pt;">   public</span><span style="font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span class="HTMLCode DefaultParagraphFont " style="font-family: Consolas;font-size: 8.0pt;">WordprocessingMLPackage process(WordprocessingMLPackage srcPackage)</span></p>1576 1577 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 11.0pt;">You pass in a docx containg altChunks, and get a  new docx back which doesnât.</span></p>1578 1579 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Table of Contents</span></p>1580 1581 <p class="Normal DocDefaults " style="space-after: 4mm;line-height: 140%;"><span style="color: #000000;font- family: Calibri;font-size: 10.0pt;"><span style="white-space:pre-wrap;">The minimal XML docx4j needs to insert into the document for </span></span><span style="font-weight: bold;color: #000000;font-family: Calibri;font-size: 10.0pt;">Microsoft Word</span><span style="color: #000000;font-family: Calibri;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> to then generate a TOC (including hyperlinks and associated bookmarks), is:</span></span></p><div style="border-color: #FCF9E0; border-style:solid; border-width:1px;background-color: #FCF9E0;space-after: 3mm;line-height: 140%;">1582 1583 <p class="Normal DocDefaults " style="border-color: #FCF9E0; border-style:solid; border-width:1px;background-color: #FCF9E0;space-after: 3mm;line-height: 140%;"><span style="color: #000000;font- family: Courier New;font-size: 8.5pt;">     <w:p></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />      <w:r></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />       <w:fldChar w:fldCharType="begin" w:dirty="true"/></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />      </w:r></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />      <w:r></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />       <w:instrText xml:space="preserve"> TOC \o "1-3" \h \z \u </w:instrText></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />      </w:r></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />      <w:r></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />       <w:fldChar w:fldCharType="end"/></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" />      </w:r></span><span style="color: #000000;font-family: Courier New;font-size: 8.5pt;"><br clear="all" /><span style="white-space:pre-wrap;">     </w:p> </span></span></p></div>1584 1585 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Trebuchet MS;font-size: 10.0pt;"><br clear="all" /></span></p>1586 1587 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 10.0pt;"><span style="white-space:pre-wrap;">Note the </span></span><span style="font-weight: bold;color: #000000;font-family: Calibri;font-size: 10.0pt;">w:dirty="true"</span><span style="color: #000000;font-family: Calibri;font-size: 10.0pt;">. The actual field code in instrText could be altered to meet your requirements.</span></p>1588 1589 <p class="Normal DocDefaults "><span style="color: #000000;font- family: Calibri;font-size: 10.0pt;">Note that simply including this is currently not enough for you to get a table of contents in your HTML or PDF output. Currently, you'd need to open/save in Word, and the HTML/PDF output would need to support the result (page numbering will be a problem).</span></p>1590 1591 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Text extraction</span></p>1592 1593 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">A quick way to extract the text from a docx, is to use </span><span style="color: #000000;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">TextUtilsâ </span></span></p>1594 1595 <p class="Normal DocDefaults "><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static void </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">extractText(Object o, Writer w)</span></p>1546 <p class="Heading1 Normal DocDefaults "><span>Merging Documents</span></p> 1547 1548 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font-size: 11.0pt;">As</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;"> </span><a href="http://blogs.msdn.com/b/ericwhite/archive/2008/11/03/inserting-deleting-moving-paragraphs-in-open-xml-wordprocessing-documents.aspx"><span class="Hyperlink DefaultParagraphFont " style="color: #AD582A;font-size: 11.0pt;">Eric Whiteâs blog explained</span></a><span style="color: #000000;font-size: 11.0pt;">, combining multiple documents can be complicated:</span></p> 1549 1550 <p class="NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="color: #777777;font-size: 11.0pt;">This programming task is complicated by the need to keep other parts of the document in sync with the data stored in paragraphs. For example, a paragraph can contain a reference to a comment in the comments part, and if there is a problem with this reference, the document is invalid. You must take care when moving / inserting / deleting paragraphs to maintain â</span><span class="Emphasis DefaultParagraphFont " style="font-weight: bold;color: #777777;font-size: 11.0pt;">referential integrity</span><span style="color: #777777;font-size: 11.0pt;">â within the document.</span></p> 1551 1552 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font-size: 11.0pt;">There is a paid extension for docx4j, called MergeDocx, which makes merging documents as easy as invoking the method:</span></p> 1553 1554 <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">   public</span><span style="font-size: 8.0pt;"><span style="white-space:pre-wrap;">  </span></span><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">WordprocessingMLPackage merge(List<WordprocessingMLPackage> wmlPkgs)</span></p> 1555 1556 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font-size: 11.0pt;">In other words, you pass a list of docx, and get a single new docx back.</span></p> 1557 1558 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font-size: 11.0pt;"><span style="white-space:pre-wrap;">The extension can also be used to process a </span></span><span style="font-weight: bold;color: #000000;font-size: 11.0pt;">docx</span><span style="color: #000000;font-size: 11.0pt;"><span style="white-space:pre-wrap;"> which is embedded as an</span></span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;"> </span><span class="Strong DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;">altChunk</span><span style="color: #000000;font-size: 11.0pt;">. (Without the extension, you have to rely on Word to convert the altChunk to normal content, which means if your docx contains w:altChunk, you have to round trip it through Word, before docx4j can create a PDF or HTML out of it.)</span></p> 1559 1560 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font-size: 11.0pt;">To process the w:altChunk elements in a docx, you invoke:</span></p> 1561 1562 <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">   public</span><span style="font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">WordprocessingMLPackage process(WordprocessingMLPackage srcPackage)</span></p> 1563 1564 <p class="NormalWeb Normal DocDefaults "><span style="color: #000000;font-size: 11.0pt;">You pass in a docx containg altChunks, and get a  new docx back which doesnât.</span></p> 1565 1566 <p class="Heading1 Normal DocDefaults "><span>Table of Contents</span></p> 1567 1568 <p class="Normal DocDefaults " style="space-after: 4mm;line-height: 140%;"><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;">The minimal XML docx4j needs to insert into the document for </span></span><span style="font-weight: bold;color: #000000;font-size: 10.0pt;">Microsoft Word</span><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;"> to then generate a TOC (including hyperlinks and associated bookmarks), is:</span></span></p><div style="border-color: #FCF9E0; border-style:solid; border-width:1px;background-color: #FCF9E0;space-after: 3mm;line-height: 140%;"> 1569 1570 <p class="Normal DocDefaults " style="border-color: #FCF9E0; border-style:solid; border-width:1px;background-color: #FCF9E0;space-after: 3mm;line-height: 140%;"><span style="color: #000000;font-size: 8.5pt;">     <w:p></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />      <w:r></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />       <w:fldChar w:fldCharType="begin" w:dirty="true"/></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />      </w:r></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />      <w:r></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />       <w:instrText xml:space="preserve"> TOC \o "1-3" \h \z \u </w:instrText></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />      </w:r></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />      <w:r></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />       <w:fldChar w:fldCharType="end"/></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" />      </w:r></span><span style="color: #000000;font-size: 8.5pt;"><br clear="all" /><span style="white-space:pre-wrap;">     </w:p> </span></span></p></div> 1571 1572 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 10.0pt;"><br clear="all" /></span></p> 1573 1574 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;">Note the </span></span><span style="font-weight: bold;color: #000000;font-size: 10.0pt;">w:dirty="true"</span><span style="color: #000000;font-size: 10.0pt;">. The actual field code in instrText could be altered to meet your requirements.</span></p> 1575 1576 <p class="Normal DocDefaults "><span style="color: #000000;font-size: 10.0pt;">Note that simply including this is currently not enough for you to get a table of contents in your HTML or PDF output. Currently, you'd need to open/save in Word, and the HTML/PDF output would need to support the result (page numbering will be a problem).</span></p> 1577 1578 <p class="Heading1 Normal DocDefaults "><span>Text extraction</span></p> 1579 1580 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">A quick way to extract the text from a docx, is to use </span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">TextUtilsâ </span></span></p> 1581 1582 <p class="Normal DocDefaults "><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static void </span></span><span style="color: #000000;font-size: 9.0pt;">extractText(Object o, Writer w)</span></p> 1596 1583 1597 1584 <p class="Normal DocDefaults ">which marshals the object it is passed via a SAX ContentHandler, in order to output the text to the Writer.</p> 1598 1585 1599 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Text substitution</span></p>1600 1601 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Text substitution is easy enough, provided the string you are searching for is represented in a </span><span style="font-weight: bold; font-family: Consolas;"><span style="white-space:pre-wrap;">org.docx4j.wml.Text </span></span>object in the form you expect.</p>1586 <p class="Heading1 Normal DocDefaults "><span>Text substitution</span></p> 1587 1588 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Text substitution is easy enough, provided the string you are searching for is represented in a </span><span style="font-weight: bold;"><span style="white-space:pre-wrap;">org.docx4j.wml.Text </span></span>object in the form you expect.</p> 1602 1589 1603 1590 <p class="Normal DocDefaults ">However, that won't necessarily be the case. The string could be broken across text runs for any of the following reasons:</p> 1604 1591 1605 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>part of the word is formatted differently (eg in bold)</p>1606 1607 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>spelling/grammar</p>1608 1609 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span>editing order (rsid)</p>1592 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>part of the word is formatted differently (eg in bold)</p> 1593 1594 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>spelling/grammar</p> 1595 1596 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>editing order (rsid)</p> 1610 1597 1611 1598 <p class="Normal DocDefaults ">This is one reason that using data bound content controls is often a better approach (see next section).</p> … … 1613 1600 <p class="Normal DocDefaults ">Subject to that, you can do text substitution in a variety of ways, for example:</p> 1614 1601 1615 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">traversing the main document part, and looking at the </span><span style="font-weight: bold;font-family: Consolas;"><span style="white-space:pre-wrap;">org.docx4j.wml.Text </span></span>objects</p>1616 1617 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">marshal to a string, search/replace in that, then unmarshall again </span></p>1602 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">traversing the main document part, and looking at the </span><span style="font-weight: bold;"><span style="white-space:pre-wrap;">org.docx4j.wml.Text </span></span>objects</p> 1603 1604 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">marshal to a string, search/replace in that, then unmarshall again </span></p> 1618 1605 1619 1606 <p class="Normal DocDefaults ">docx4jâs XmlUtils also contains:</p> 1620 1607 1621 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/**</span></p>1622 1623 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* Give a string of wml containing ${key1}, ${key2}, return a suitable</span></p>1624 1625 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* object.*/</span></p>1626 1627 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Object unmarshallFromTemplate(String wmlTemplateString, </span></span></p>1628 1629 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">java.util.HashMap<String, String> mappings) </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span></p>1608 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/**</span></p> 1609 1610 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* Give a string of wml containing ${key1}, ${key2}, return a suitable</span></p> 1611 1612 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* object.*/</span></p> 1613 1614 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Object unmarshallFromTemplate(String wmlTemplateString, </span></span></p> 1615 1616 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">java.util.HashMap<String, String> mappings) </span></span><span style="color: #000000;font-size: 9.0pt;"><br clear="all" /></span></p> 1630 1617 1631 1618 <p class="Normal DocDefaults ">See the UnmarshallFromTemplate example, which operates on a string containing:</p> 1632 1619 1633 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font- family: Consolas;font-size: 12.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;"><w:p></span></p>1634 1635 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <w:r></span></p>1636 1637 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <w:t></span><span style="color: #000000;font-family: Consolas;font-size: 10.0pt;"><span style="white-space:pre-wrap;">My favourite colour is </span></span><span style="font-weight: bold;color: #000000;font-family: Consolas;font-size: 10.0pt;">${colour}</span><span style="color: #000000;font-family: Consolas;font-size: 10.0pt;">.</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;"><</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:t></span></p>1638 1639 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:r></span></p>1640 1641 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:p></span></p>1642 1643 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   <span style="white-space:pre-wrap;"><w:p </span></span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">></span></p>1644 1645 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   <w:p></span></p>1646 1647 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <w:r></span></p>1648 1649 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <w:t></span><span style="color: #000000;font-family: Consolas;font-size: 10.0pt;"><span style="white-space:pre-wrap;">My favourite ice cream is </span></span><span style="font-weight: bold;color: #000000;font-family: Consolas;font-size: 10.0pt;">${icecream}</span><span style="color: #000000;font-family: Consolas;font-size: 10.0pt;">.</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;"><</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:t></span></p>1650 1651 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   </span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:r></span></p>1652 1653 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font- family: Consolas;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-family: Consolas;font-size: 10.0pt;">/</span><span style="color: #800000;font-family: Consolas;font-size: 10.0pt;">w:p></span></p>1654 1655 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1656 1657 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Text substitution via data bound content controls</span></p>1620 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font-size: 12.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;"><w:p></span></p> 1621 1622 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <w:r></span></p> 1623 1624 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <w:t></span><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;">My favourite colour is </span></span><span style="font-weight: bold;color: #000000;font-size: 10.0pt;">${colour}</span><span style="color: #000000;font-size: 10.0pt;">.</span><span style="color: #800000;font-size: 10.0pt;"><</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:t></span></p> 1625 1626 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:r></span></p> 1627 1628 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:p></span></p> 1629 1630 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   <span style="white-space:pre-wrap;"><w:p </span></span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">></span></p> 1631 1632 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   <w:p></span></p> 1633 1634 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <w:r></span></p> 1635 1636 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <w:t></span><span style="color: #000000;font-size: 10.0pt;"><span style="white-space:pre-wrap;">My favourite ice cream is </span></span><span style="font-weight: bold;color: #000000;font-size: 10.0pt;">${icecream}</span><span style="color: #000000;font-size: 10.0pt;">.</span><span style="color: #800000;font-size: 10.0pt;"><</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:t></span></p> 1637 1638 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   </span><span style="color: #800000;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:r></span></p> 1639 1640 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #800000;font-size: 10.0pt;">   <</span><span style="color: #0000FF;font-size: 10.0pt;">/</span><span style="color: #800000;font-size: 10.0pt;">w:p></span></p> 1641 1642 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1643 1644 <p class="Heading1 Normal DocDefaults "><span>Text substitution via data bound content controls</span></p> 1658 1645 1659 1646 <p class="Normal DocDefaults ">If you have an XML file containing your own data, WordML has a mechansim for associating entries in that XML with content controls in the document.</p> … … 1663 1650 <p class="Normal DocDefaults ">This works using XPath. A data-bound content control looks something like:</p> 1664 1651 1665 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:sdt</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1666 1667 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:sdtPr</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1668 1669 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:dataBinding</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 7.5pt;">w:xpath</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">=</span><span style="font-family: Consolas;font-size: 7.5pt;">"</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">/root[1]/customer[1]</span><span style="font-family: Consolas;font-size: 7.5pt;">"</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 7.5pt;">w:storeItemID</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">=</span><span style="font-family: Consolas;font-size: 7.5pt;">"</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">{428C88D8-C0E3-44F0-B5D7-F65D8B9F7EC9}</span><span style="font-family: Consolas;font-size: 7.5pt;">"</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> /></span></span></p>1670 1671 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:sdtPr</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1672 1673 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:sdtContent</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1674 1675 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:r</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1676 1677 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:rPr</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1678 1679 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:rStyle</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-family: Consolas;font-size: 7.5pt;">w:val</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">=</span><span style="font-family: Consolas;font-size: 7.5pt;">"</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">PlaceholderText</span><span style="font-family: Consolas;font-size: 7.5pt;">"</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> /></span></span></p>1680 1681 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:rPr</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1682 1683 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:t</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span><span style="font-family: Consolas;font-size: 7.5pt;">Click here to enter text.</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;"></</span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:t</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1684 1685 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:r</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1686 1687 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:sdtContent</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1688 1689 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font- family: Consolas;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-family: Consolas;font-size: 7.5pt;">w:sdt</span><span style="color: #0000FF;font-family: Consolas;font-size: 7.5pt;">></span></p>1652 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:sdt</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1653 1654 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:sdtPr</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1655 1656 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:dataBinding</span><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-size: 7.5pt;">w:xpath</span><span style="color: #0000FF;font-size: 7.5pt;">=</span><span style="font-size: 7.5pt;">"</span><span style="color: #0000FF;font-size: 7.5pt;">/root[1]/customer[1]</span><span style="font-size: 7.5pt;">"</span><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-size: 7.5pt;">w:storeItemID</span><span style="color: #0000FF;font-size: 7.5pt;">=</span><span style="font-size: 7.5pt;">"</span><span style="color: #0000FF;font-size: 7.5pt;">{428C88D8-C0E3-44F0-B5D7-F65D8B9F7EC9}</span><span style="font-size: 7.5pt;">"</span><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> /></span></span></p> 1657 1658 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-size: 7.5pt;">w:sdtPr</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1659 1660 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:sdtContent</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1661 1662 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:r</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1663 1664 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:rPr</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1665 1666 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:rStyle</span><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #FF0000;font-size: 7.5pt;">w:val</span><span style="color: #0000FF;font-size: 7.5pt;">=</span><span style="font-size: 7.5pt;">"</span><span style="color: #0000FF;font-size: 7.5pt;">PlaceholderText</span><span style="font-size: 7.5pt;">"</span><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> /></span></span></p> 1667 1668 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-size: 7.5pt;">w:rPr</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1669 1670 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> <</span></span><span style="color: #A31515;font-size: 7.5pt;">w:t</span><span style="color: #0000FF;font-size: 7.5pt;">></span><span style="font-size: 7.5pt;">Click here to enter text.</span><span style="color: #0000FF;font-size: 7.5pt;"></</span><span style="color: #A31515;font-size: 7.5pt;">w:t</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1671 1672 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-size: 7.5pt;">w:r</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1673 1674 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-size: 7.5pt;">w:sdtContent</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1675 1676 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #0000FF;font-size: 7.5pt;"><span style="white-space:pre-wrap;"> </</span></span><span style="color: #A31515;font-size: 7.5pt;">w:sdt</span><span style="color: #0000FF;font-size: 7.5pt;">></span></p> 1690 1677 1691 1678 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 1699 1686 <p class="Normal DocDefaults ">Your XML is represented using 2 parts:</p> 1700 1687 1701 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">CustomXmlDataStoragePart customXmlDataStoragePart </span></span></p>1702 1703 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   = wordMLPackage.getCustomXmlDataStorageParts().get(itemId);</span></p>1704 1705 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1706 1707 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">CustomXmlDataStorage customXmlDataStorage </span></span></p>1708 1709 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   = customXmlDataStoragePart.getData();</span></p>1688 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">CustomXmlDataStoragePart customXmlDataStoragePart </span></span></p> 1689 1690 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   = wordMLPackage.getCustomXmlDataStorageParts().get(itemId);</span></p> 1691 1692 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1693 1694 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   <span style="white-space:pre-wrap;">CustomXmlDataStorage customXmlDataStorage </span></span></p> 1695 1696 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   = customXmlDataStoragePart.getData();</span></p> 1710 1697 1711 1698 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 1713 1700 <p class="Normal DocDefaults ">To apply the bindings:</p> 1714 1701 1715 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Consolas;font-size: 8.0pt;">   </span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">   customXmlDataStoragePart.</span><span style="color: #000000;font-style: italic;font-family: Consolas;font-size: 8.0pt;">applyBindings</span><span style="color: #000000;font-family: Consolas;font-size: 8.0pt;">(wordMLPackage.getMainDocumentPart());</span></p>1702 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;">   </span><span style="color: #000000;font-size: 8.0pt;">   customXmlDataStoragePart.</span><span style="color: #000000;font-style: italic;font-size: 8.0pt;">applyBindings</span><span style="color: #000000;font-size: 8.0pt;">(wordMLPackage.getMainDocumentPart());</span></p> 1716 1703 1717 1704 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> … … 1727 1714 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">A content control is a </span><span style="font-style: italic;">repeat</span><span style="white-space:pre-wrap;"> if it designates that its contents are to be included more than once. For example, a row of a table for each invoice/order item, or person.</span></p> 1728 1715 1729 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">docx4j (from 2.5.0) contains a mechanism for processing conditional content controls and repeats. See </span><a href="http:// dev.plutext.org/svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.docx"><span class="Hyperlink DefaultParagraphFont ">http://dev.plutext.org/svn/docx4j/trunk/docx4j/sample-docs/databinding/conventions.docx</span></a><span style="white-space:pre-wrap;"> for an explanation.</span></p><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;">1730 1731 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000; font-family: Calibri;">docx4j v2.5.0 implemented v1 of the conventions. docx4j v2.6.0 implements v2 of the conventions. You are advised to use a v2 implementation. See forum post for further details.</span></p></div></div>1716 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">docx4j (from 2.5.0) contains a mechanism for processing conditional content controls and repeats. See </span><a href="http://www.opendope.org/opendope_conventions_v2.3.html"><span class="Hyperlink DefaultParagraphFont ">http://www.opendope.org/opendope_conventions_v2.3.html</span></a><span style="white-space:pre-wrap;"> for an explanation.</span></p><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><div style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"> 1717 1718 <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #EEECE1; border-style:solid; border-width:1px;background-color: #EEECE1;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;">docx4j v2.5.0 implemented v1 of the conventions. docx4j v2.6.0 implements v2 of the conventions. You are advised to use a v2 implementation. See forum post for further details.</span></p></div></div> 1732 1719 1733 1720 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">To set up the bindings, you can use the Word Add-In from </span><a href="http://dev.plutext.org/opendope/setup.exe"><span class="Hyperlink DefaultParagraphFont ">http://dev.plutext.org/opendope/setup.exe</span></a><span style="white-space:pre-wrap;"> Please note that you will need to install .NET Framework 4.0 ("full" - the "client profile" is not enough).</span></p> … … 1735 1722 <p class="Normal DocDefaults ">See also the docx4j sample ContentControlBindingExtensions.</p> 1736 1723 1724 <p class="Heading1 Normal DocDefaults ">SmartArt</p> 1725 1726 <p class="Normal DocDefaults ">docx4j supports reading docx and pptx files which contain SmartArt.</p> 1727 1728 <p class="Normal DocDefaults ">From docx4j 2.7.0, you can also generate SmartArt.</p> 1729 1730 <p class="Normal DocDefaults ">To do this, you need:</p> 1731 1732 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">the layout definition for the SmartArt, either in the docx already, or from a glox file </span></p> 1733 1734 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>an XML file specifying the list of text items you want to render graphically</p> 1735 1736 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>an XSLT which can convert a transformed version of that XML file into a SmartArt data file.</p> 1737 1738 <p class="Normal DocDefaults ">Docx4j can be used to insert the SmartArt parts into a docx; Word or Powerpoint will then render it when the document is opened.</p> 1739 1740 <p class="Normal DocDefaults ">The code can be found in:</p> 1741 1742 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>org.opendope.SmartArt.dataHierarchy</p> 1743 1744 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>org.docx4j.openpackaging.parts.DrawingML, and</p> 1745 1746 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.52in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span>src/glox4j/java</p> 1747 1737 1748 <p class="Heading1 Normal DocDefaults ">Work with the âFlat OPC XML Formatâ</p> 1738 1749 … … 1759 1770 <p class="Normal DocDefaults ">Converting to/from Flat OPC can be done at the command line, with:</p> 1760 1771 1761 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Courier New;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.</span><span style="white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Courier New;font-size: 6.5pt;">ExportInPackageFormat [input.docx]</span></p>1762 1763 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Trebuchet MS;font-size: 8.0pt;"><span style="white-space:pre-wrap;">(and similar for ImportFromPackageFormat). </span></span></p>1764 1765 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Trebuchet MS;font-size: 8.0pt;">If there are any images in the docx, you'd also need to add to your classpath: xmlgraphics-commons-1.4.jar and commons-logging-1.1.1.jar</span></p>1772 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;">   java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.</span><span style="white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;">ExportInPackageFormat [input.docx]</span></p> 1773 1774 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">(and similar for ImportFromPackageFormat). </span></span></p> 1775 1776 <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">If there are any images in the docx, you'd also need to add to your classpath: xmlgraphics-commons-1.4.jar and commons-logging-1.1.1.jar</span></p> 1766 1777 1767 1778 <p class="Heading1 Normal DocDefaults ">JAXB stuff</p> … … 1771 1782 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">To clone a JAXB object, use one of the following methods in XmlUtils:</p> 1772 1783 1773 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">/** Clone this JAXB object, using default JAXBContext. */ </span></span></p>1774 1775 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"><T> T deepCopy(T value) </span></span></p>1776 1777 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>1778 1779 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/** Clone this JAXB object */</span></p>1780 1781 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"><T> T deepCopy(T value, JAXBContext jc) </span></span></p>1784 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;"><span style="white-space:pre-wrap;">/** Clone this JAXB object, using default JAXBContext. */ </span></span></p> 1785 1786 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"><T> T deepCopy(T value) </span></span></p> 1787 1788 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 1789 1790 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/** Clone this JAXB object */</span></p> 1791 1792 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"><T> T deepCopy(T value, JAXBContext jc) </span></span></p> 1782 1793 1783 1794 <p class="Heading2 Normal DocDefaults "><a name="_Ref273527051" />@XmlRootElement</p> 1784 1795 1785 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Most commonly used objects have an </span><span style="font-weight: bold; font-family: Consolas;"><span style="white-space:pre-wrap;">@XmlRootElement </span></span><span style="white-space:pre-wrap;">annotation, so they can be marshalled and unmarshalled. </span></p>1796 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Most commonly used objects have an </span><span style="font-weight: bold;"><span style="white-space:pre-wrap;">@XmlRootElement </span></span><span style="white-space:pre-wrap;">annotation, so they can be marshalled and unmarshalled. </span></p> 1786 1797 1787 1798 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">In some cases, you might find this annotation is missing. </span></p> … … 1789 1800 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="white-space:pre-wrap;">If you can't add the annotation to the jaxb source code, an alternative is to </span><span style="text-decoration: none;">marshall</span><span style="white-space:pre-wrap;"> it using code which is explicit about the resulting QName. For example, XmlUtils contains:</span></p> 1790 1801 1791 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">/** Marshal to a W3C document, for object</span></p>1792 1793 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-family: Consolas;font-size: 9.0pt;">* missing an @XmlRootElement annotation. */</span></p>1794 1795 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.w3c.dom.Document marshaltoW3CDomDocument(Object o, JAXBContext jc,</span><span style="font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">String uri, String local, Class declaredType) </span></span></p>1802 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">/** Marshal to a W3C document, for object</span></p> 1803 1804 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F5FBF;font-size: 9.0pt;">* missing an @XmlRootElement annotation. */</span></p> 1805 1806 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">public static </span></span><span style="color: #000000;font-size: 9.0pt;">org.w3c.dom.Document marshaltoW3CDomDocument(Object o, JAXBContext jc,</span><span style="font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">String uri, String local, Class declaredType) </span></span></p> 1796 1807 1797 1808 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;">You could use this like so:</p> 1798 1809 1799 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">CTFootnotes footnotes = </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">wmlPackage.getMainDocumentPart().getFootnotesPart().getJaxbElement().getValue();</span></p>1800 1801 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">CTFtnEdn ftn = footnotes.getFootnote().get(1);</span></p>1802 1803 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>1804 1805 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">// No @XmlRootElement on CTFtnEdn, so .. </span></span></p>1806 1807 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">Document d = XmlUtils.marshaltoW3CDomDocument( ftn,</span></p>1808 1809 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Context.jc, Namespaces.NS_WORD12, </span></span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;">"footnote"</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">, CTFtnEdn.</span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">class </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">);</span></p>1810 1811 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Where the problematic object is something you're adding which isn't at the top of the tree, you should add it wrapped in a JAXBElement. For example, suppose you wanted to add </span></span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">FldChar fldchar. You'd create it in the ordinary way:</span></p>1812 1813 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> FldChar fldchar = factory.createFldChar();</span></span></p>1814 1815 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font- family: Consolas;font-size: 9.0pt;">but then what you'd actually add to r.getRunContent() is:</span><span style="color: #000000;font-family: Courier New;font-size: 9.0pt;">   </span></p>1816 1817 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font- family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">new</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> JAXBElement( </span></span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">new</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> QName(Namespaces.</span></span><span style="color: #0000C0;font-style: italic;font-family: Courier New;font-size: 8.0pt;">NS_WORD12</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;"><span style="white-space:pre-wrap;">, </span></span><span style="color: #2A00FF;font-family: Courier New;font-size: 8.0pt;">"fldChar"</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">), FldChar.</span><span style="font-weight: bold;color: #7F0055;font-family: Courier New;font-size: 8.0pt;">class</span><span style="color: #000000;font-family: Courier New;font-size: 8.0pt;">, fldchar);</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-family: Consolas;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span></p>1810 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">CTFootnotes footnotes = </span></span><span style="color: #000000;font-size: 9.0pt;"><br clear="all" /></span><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">wmlPackage.getMainDocumentPart().getFootnotesPart().getJaxbElement().getValue();</span></p> 1811 1812 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">CTFtnEdn ftn = footnotes.getFootnote().get(1);</span></p> 1813 1814 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 1815 1816 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #3F7F5F;font-size: 9.0pt;"><span style="white-space:pre-wrap;">// No @XmlRootElement on CTFtnEdn, so .. </span></span></p> 1817 1818 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">Document d = XmlUtils.marshaltoW3CDomDocument( ftn,</span></p> 1819 1820 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Context.jc, Namespaces.NS_WORD12, </span></span><span style="color: #2A00FF;font-size: 9.0pt;">"footnote"</span><span style="color: #000000;font-size: 9.0pt;">, CTFtnEdn.</span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">class </span></span><span style="color: #000000;font-size: 9.0pt;">);</span></p> 1821 1822 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">Where the problematic object is something you're adding which isn't at the top of the tree, you should add it wrapped in a JAXBElement. For example, suppose you wanted to add </span></span><span style="color: #000000;font-size: 9.0pt;">FldChar fldchar. You'd create it in the ordinary way:</span></p> 1823 1824 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> FldChar fldchar = factory.createFldChar();</span></span></p> 1825 1826 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;">but then what you'd actually add to r.getRunContent() is:</span><span style="color: #000000;font-size: 9.0pt;">   </span></p> 1827 1828 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">new</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> JAXBElement( </span></span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">new</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> QName(Namespaces.</span></span><span style="color: #0000C0;font-style: italic;font-size: 8.0pt;">NS_WORD12</span><span style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;">, </span></span><span style="color: #2A00FF;font-size: 8.0pt;">"fldChar"</span><span style="color: #000000;font-size: 8.0pt;">), FldChar.</span><span style="font-weight: bold;color: #7F0055;font-size: 8.0pt;">class</span><span style="color: #000000;font-size: 8.0pt;">, fldchar);</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span style="white-space:pre-wrap;"> </span></span></p> 1818 1829 1819 1830 <p class="Normal DocDefaults " style="space-before: 0.07in;space-after: 0.07in;line-height: 100%;" /> … … 1821 1832 <p class="Heading2 Normal DocDefaults "><span>javax.xml.bind.JAXBElement</span></p> 1822 1833 1823 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">One annoying thing about JAXB, is that an object â say a table â could be represented as </span><span style="color: #2A00FF;font- family: Consolas;font-size: 9.0pt;">org.docx4j.wml.Tbl</span><span style="white-space:pre-wrap;"> (as you would expect). Or it might be wrapped in a </span><span style="font-weight: bold;color: #000000;font-family: Consolas;font-size: 9.0pt;">javax.xml.bind.JAXBElement</span>, in which case to get the real table, you have to do something like:</p>1824 1825 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">if </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">( ((JAXBElement)o).getDeclaredType().getName().equals(</span><span style="color: #2A00FF;font-family: Consolas;font-size: 9.0pt;">"org.docx4j.wml.Tbl"</span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;">) ) </span></span></p>1826 1827 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font- family: Consolas;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-family: Consolas;font-size: 9.0pt;">org.docx4j.wml.Tbl tbl = (org.docx4j.wml.Tbl)((JAXBElement)o).getValue();</span></p>1834 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">One annoying thing about JAXB, is that an object â say a table â could be represented as </span><span style="color: #2A00FF;font-size: 9.0pt;">org.docx4j.wml.Tbl</span><span style="white-space:pre-wrap;"> (as you would expect). Or it might be wrapped in a </span><span style="font-weight: bold;color: #000000;font-size: 9.0pt;">javax.xml.bind.JAXBElement</span>, in which case to get the real table, you have to do something like:</p> 1835 1836 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="font-weight: bold;color: #7F0055;font-size: 9.0pt;"><span style="white-space:pre-wrap;">if </span></span><span style="color: #000000;font-size: 9.0pt;">( ((JAXBElement)o).getDeclaredType().getName().equals(</span><span style="color: #2A00FF;font-size: 9.0pt;">"org.docx4j.wml.Tbl"</span><span style="color: #000000;font-size: 9.0pt;"><span style="white-space:pre-wrap;">) ) </span></span></p> 1837 1838 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="color: #FFFFFF;font-size: 9.0pt;"><span style="white-space:pre-wrap;"> </span></span><span style="color: #000000;font-size: 9.0pt;">org.docx4j.wml.Tbl tbl = (org.docx4j.wml.Tbl)((JAXBElement)o).getValue();</span></p> 1828 1839 1829 1840 <p class="Normal DocDefaults " /> … … 1833 1844 <p class="Normal DocDefaults ">Be careful, though. If you are intend to copy an unwrapped object into your document (rather than just read it), you'll probably want the object to remain wrapped (JAXB usually wraps them for a reason; without the wrapper, you might find you need an @XmlRootElement annotation in order to be able to marshall ie save your document).</p> 1834 1845 1835 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">docx4j-extras</span></p>1836 1837 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span style="font-family: Calibri;">src/docx4j-extras contains functionality which is not part of the standard docx4j build:</span></p>1838 1839 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1840 1841 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="font-family: Calibri;">load/save via JCR, which</span></p>1842 1843 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="font-family: Calibri;">PDF conversion via HTML or iText</span></p>1844 1845 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">The docx4j forum</span></p>1846 <p class="Heading1 Normal DocDefaults "><span>docx4j-extras</span></p> 1847 1848 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;"><span>src/docx4j-extras contains functionality which is not part of the standard docx4j build:</span></p> 1849 1850 <p class="Normal DocDefaults " style="space-after: 0in;line-height: 100%;" /> 1851 1852 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span>load/save via JCR</span></p> 1853 1854 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;space-after: 0in;line-height: 100%;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span>PDF conversion via HTML or iText</span></p> 1855 1856 <p class="Heading1 Normal DocDefaults "><span>The docx4j forum</span></p> 1846 1857 1847 1858 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Free community support is available in the docx4j forum, at </span><a href="http://dev.plutext.org/forums/"><span style="color: #0000FF;text-decoration: none;">http://dev.plutext.org/forums/</span></a></p> … … 1851 1862 <p class="Normal DocDefaults ">This discussion is generally in English. If you can volunteer to moderate a forum in another language (for example, French, Chinese, SpanishâŠ), please let us know.</p> 1852 1863 1853 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Other Support Options</span></p>1854 1855 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">If the free community support available in the docx4j forum does not meet your needs, or you simply want to outsource some coding, you are welcome to purchase programming, consulting and priority support from </span><a href="http://www.plutext.com/m/index.php/docx4j-support.html"><span class="Hyperlink DefaultParagraphFont " style="font- family: Trebuchet MS;font-size: 10.0pt;">http://www.plutext.com/m/index.php/docx4j-support.html</span></a></p>1864 <p class="Heading1 Normal DocDefaults "><span>Other Support Options</span></p> 1865 1866 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">If the free community support available in the docx4j forum does not meet your needs, or you simply want to outsource some coding, you are welcome to purchase programming, consulting and priority support from </span><a href="http://www.plutext.com/m/index.php/docx4j-support.html"><span class="Hyperlink DefaultParagraphFont " style="font-size: 10.0pt;">http://www.plutext.com/m/index.php/docx4j-support.html</span></a></p> 1856 1867 1857 1868 <p class="Normal DocDefaults ">By purchasing services from Plutext, you support the continued development of docx4j.</p> 1858 1869 1859 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Colophon</span></p>1870 <p class="Heading1 Normal DocDefaults "><span>Colophon</span></p> 1860 1871 1861 1872 <p class="Normal DocDefaults ">This document was written in Word 2007, using:</p> 1862 1873 1863 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">XML pretty printed using </span><a href="http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx"><span style="color: #0000FF;text-decoration: none;">http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx</span></a><span style="white-space:pre-wrap;"> or Package Explorer</span></p>1864 1865 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in; font-family: Symbol;">ï· </span><span style="white-space:pre-wrap;">Java source code formatted using </span><a href="http://www.java2html.de"><span class="Hyperlink DefaultParagraphFont ">http://www.java2html.de</span></a><span style="white-space:pre-wrap;"> (or cut/pasted from Eclipse)</span></p>1874 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">XML pretty printed using </span><a href="http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx"><span style="color: #0000FF;text-decoration: none;">http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx</span></a><span style="white-space:pre-wrap;"> or Package Explorer</span></p> 1875 1876 <p class="ListParagraph Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span style="position: absolute; left:-0.25in; max-width: 0.25in;">ï· </span><span style="white-space:pre-wrap;">Java source code formatted using </span><a href="http://www.java2html.de"><span class="Hyperlink DefaultParagraphFont ">http://www.java2html.de</span></a><span style="white-space:pre-wrap;"> (or cut/pasted from Eclipse)</span></p> 1866 1877 1867 1878 <p class="Normal DocDefaults ">The PDF and HTML versions were generated using docx4j (PDF via XSL FO and FOP).</p> 1868 1879 1869 <p class="Heading1 Normal DocDefaults "><span style="font-family: Calibri;">Contacting Plutext</span></p>1880 <p class="Heading1 Normal DocDefaults "><span>Contacting Plutext</span></p> 1870 1881 1871 1882 <p class="Normal DocDefaults "><span style="white-space:pre-wrap;">Unless you have paid for support, general âHow do Iâ type questions should be posted directly to the </span><a href="http://dev.plutext.org/forums/"><span class="Hyperlink DefaultParagraphFont ">docx4j forum</span></a>. Plutext may post to the forum any questions it receives by email which should have been directed to the forum.</p> … … 1895 1906 <p class="Footer Normal DocDefaults " /></div> 1896 1907 1897 < !-- userBodyTail goes here -->1908 <H1>TAIL!</H1> 1898 1909 1899 1910 </body></html> -
trunk/docx4j/src/main/java/org/docx4j/samples/CreateHtml.java
r1384 r1590 48 48 getInputFilePath(args); 49 49 } catch (IllegalArgumentException e) { 50 inputfilepath = System.getProperty("user.dir") + "/docs/Docx4j_GettingStarted. docx";50 inputfilepath = System.getProperty("user.dir") + "/docs/Docx4j_GettingStarted.xml"; 51 51 } 52 52 System.out.println(inputfilepath);
Note: See TracChangeset
for help on using the changeset viewer.
