When the docx document contains the "distributed" paragraph alignment, the output document it produces cannot be opened by Word. Having traced the XML a bit, we found that the attribute of the <w:jc> tag, which was originally present in the template, was removed by docx4j after processing.
We are using docx4j 2.7.0 and Microsoft Word 2007. Attached are the template file and the output file.
Here is the code:
public class Test {
private static final String TEMPLATE_FILE_NAME = "/TestJC/template.docx";
private static final String OUTPUT_FILE = "/TestJC/output.docx";
/**
* @param args
* @throws Docx4JException
*/
public static void main(String[] args) throws Docx4JException {
WordprocessingMLPackage wmlPackage = WordprocessingMLPackage.load(new File(TEMPLATE_FILE_NAME));
SaveToZipFile file = new SaveToZipFile(wmlPackage);
file.save(OUTPUT_FILE);
}
}
The <w:jc> tag's attribute has been removed by Docx4J.
<w:jc w:val="distribute"/> --> <w:jc/>
Is this a bug?