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 ...