As i am dynamically generating docx file using OpenDope , in order to update the Toc , i have called the below
- Code: Select all
DocumentSettingsPart dsp = documentPart.getDocumentSettingsPart();
CTSettings objCTSettings = dsp.getJaxbElement();
ObjectFactory factory = Context.getWmlObjectFactory();
CTView ctView = factory.createCTView();
ctView.setVal(STView.PRINT);
objCTSettings.setView(ctView);
BooleanDefaultTrue b = new BooleanDefaultTrue();
b.setVal(true);
objCTSettings.setUpdateFields(b);
dsp.setJaxbElement(objCTSettings);
documentPart.addTargetPart(dsp);
in Linux LiberOffice , the Toc gets updated with out warning . and in Office 2013 i tested it will ask the below message before update .
"This document contains fields that may refer to other files. Do you want to update the fields in this document?"
It is fine for me .
My problem is that , in some windows environment it is not asking to update TOC upon open , and Hence the TOC is not updated . So user have to manually press F9 to update it .
Is this feature system specific or MS office package specifice . or what i needs to do further to always ask for this message while open docx file .
i want either of the option :
1 . Updates TOC without asking or
2 . Always asks for update TOC , while docx opens ..
Pleease help