}
StyleRenamer styleRenamer = new StyleRenamer();
try { // see comments on overrideTableStyleFontSizeAndJustification at line 350 below
DocumentSettingsPart dsp = wmlPackage.getMainDocumentPart().getDocumentSettingsPart();
if (dsp==null) {
dsp = new DocumentSettingsPart();
wmlPackage.getMainDocumentPart().addTargetPart(dsp);
dsp.setContents( Context.getWmlObjectFactory().createCTSettings() );
// no need to set styleRenamer.overrideTableStyleFontSizeAndJustification,
// since the default is what we want in this case
} else {
styleRenamer.overrideTableStyleFontSizeAndJustification
= dsp.getWordCompatSetting("overrideTableStyleFontSizeAndJustification");
if (styleRenamer.overrideTableStyleFontSizeAndJustification==null) {
styleRenamer.overrideTableStyleFontSizeAndJustification=defaultSetting;
// TODO,consider making the function return the default value?
}
}
// For our output docx, we always want:-
dsp.setWordCompatSetting("overrideTableStyleFontSizeAndJustification", "1");
// since the p styles we make/use take the table style into account
} catch (Docx4JException e) {
log.error(e.getMessage(), e);
}