Page 1 of 1

Is it possible to turn off the 2012 extensions

PostPosted: Fri Jul 25, 2014 8:11 am
by RFleischman
I have a need to generate a document without the <w15:collapsed w:val="false" /> tag which seems to be coming from the 2012 docx extensions.

Is it possible to easily disable this?

Thanks

Re: Is it possible to turn off the 2012 extensions

PostPosted: Tue Jul 29, 2014 2:39 am
by RFleischman
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.

Re: Is it possible to turn off the 2012 extensions

PostPosted: Tue Jul 29, 2014 10:32 am
by jason
So SharePoint is corrupting the document, by incorrectly changing the w15 namespace to 2012/wordml?!

What version of SharePoint is that, and is this a known/documented issue?