My problem is related to Sharepoint and its document generation engine.
Doc4J puts <w15:collapsed w:val="false" /> in the first paragraph of a document. (I think this is to get the namespace added to the document)
Sharepoint converts this to <collapsed w:val="false" xmlns="http://schemas.microsoft.com/office/word/2012/wordml" /> which in turn causes an error when you try and open the document in Word 2010 (it will open in 2013 but that doesn't help our situation).
I modified the following code from MainDocumentPartMceIgnorableHelper to eliminate the issue for me.
- Code: Select all
// For W15, collapse
/*
* Bob Fleischman - commented this out to generat docs without the namespace issue
PPr ppr = p.getPPr();
if (ppr==null) {
ppr = Context.getWmlObjectFactory().createPPr();
p.setPPr(ppr);
}
if (ppr.getCollapsed()==null) {
BooleanDefaultTrue notCollapsed = new BooleanDefaultTrue();
notCollapsed.setVal(Boolean.FALSE);
ppr.setCollapsed(notCollapsed);
}
*/
If this were going to be configurable in the properties file (as suggested by the comment in the code) how would it be implemented?
Bob
ps. The W15 namespace still appears at the top of the document but we do not get the bogus 'collapsed' element so everything works fine.