/** * @param createIfAbsent * @return * @throws InvalidFormatException * @since 3.3.0 */ public DocumentSettingsPart getDocumentSettingsPart(boolean createIfAbsent) throws InvalidFormatException { if (documentSettingsPart==null) { if (createIfAbsent) { documentSettingsPart = new DocumentSettingsPart(); this.addTargetPart(documentSettingsPart); documentSettingsPart.setContents(new CTSettings()); } else { return null; } } return documentSettingsPart; }
public PropertyResolver(WordprocessingMLPackage wordMLPackage) throws Docx4JException { this.wordMLPackage = wordMLPackage; MainDocumentPart mdp = wordMLPackage.getMainDocumentPart(); styleDefinitionsPart = mdp.getStyleDefinitionsPart(true); themePart = mdp.getThemePart(); numberingDefinitionsPart = mdp.getNumberingDefinitionsPart(); if (wordMLPackage.getMainDocumentPart().getDocumentSettingsPart()!=null && wordMLPackage.getMainDocumentPart().getDocumentSettingsPart().getContents()!=null) { themeFontLang = wordMLPackage.getMainDocumentPart().getDocumentSettingsPart().getContents().getThemeFontLang(); } init(); }
/** * Attach a template to this document. * This is just an easy way to access the same method in DocumentSettingsPart * * @param templatePath * @since 6.1.0 */ public void attachTemplate(String templatePath) { DocumentSettingsPart dsp = null; try { dsp = this.getDocumentSettingsPart(true); } catch (InvalidFormatException e) { // shouldn't happen log.error(e.getMessage(), e); } dsp.attachTemplate(templatePath); }
if (this.getJaxbElement()==null) { this.jaxbElement=new CTSettings(); RelationshipsPart rp = this.getRelationshipsPart(true); CTRel relId = getJaxbElement().getAttachedTemplate(); if (relId==null) { relId = Context.getWmlObjectFactory().createCTRel(); new QName("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "attachedTemplate"), CTRel.class, null, relId); this.getJaxbElement().setAttachedTemplate(je.getValue());
if (dsp == null) { dsp = new DocumentSettingsPart(); myDocumentPart.addTargetPart(dsp); CTSettings settings = dsp.getContents(); if (settings == null) { settings = myFactory.createCTSettings(); dsp.setJaxbElement(settings);
DocumentSettingsPart dsp = new DocumentSettingsPart(); wmlPack.getMainDocumentPart().addTargetPart(dsp); dsp.setJaxbElement(new CTSettings()); dsp.setOverrideTableStyleFontSizeAndJustification(true);
DocumentSettingsPart dsp = wmlPackage.getMainDocumentPart().getDocumentSettingsPart(); if (dsp==null) { dsp = new DocumentSettingsPart(); wmlPackage.getMainDocumentPart().addTargetPart(dsp); dsp.setContents( Context.getWmlObjectFactory().createCTSettings() ); = dsp.getWordCompatSetting("overrideTableStyleFontSizeAndJustification"); if (styleRenamer.overrideTableStyleFontSizeAndJustification==null) { styleRenamer.overrideTableStyleFontSizeAndJustification=defaultSetting; dsp.setWordCompatSetting("overrideTableStyleFontSizeAndJustification", "1");
@Override public String getMceIgnorable() { return this.getJaxbElement().getIgnorable(); }
public Part CreateDocumentSettingsPartObject(String partName) throws InvalidFormatException { return new DocumentSettingsPart(new PartName(partName)); }
public DocumentSettingsPart(PartName partName) throws InvalidFormatException { super(partName); init(); }
/** * Get the value of compatSetting overrideTableStyleFontSizeAndJustification * * @since 3.3.0 */ public boolean overrideTableStyleFontSizeAndJustification() { CTCompatSetting overrideTableStyleFontSizeAndJustification = this.getWordCompatSetting("overrideTableStyleFontSizeAndJustification"); // false is the default, though Word 2010/13/16 set it to true if (overrideTableStyleFontSizeAndJustification==null || overrideTableStyleFontSizeAndJustification.getVal()==null) return false; return ( overrideTableStyleFontSizeAndJustification.getVal().equals("1") || overrideTableStyleFontSizeAndJustification.getVal().toLowerCase().equals("true") || overrideTableStyleFontSizeAndJustification.getVal().toLowerCase().equals("yes") ); }
documentSettingsPart.protectRestrictEditing(editValue, password, hashAlgo);
documentSettingsPart.protectRestrictFormatting(autoFormatOverride, styleLockTheme, styleLockQFSet, password, hashAlgo);
DocumentSettingsPart dsp = new DocumentSettingsPart(); wmlPack.getMainDocumentPart().addTargetPart(dsp); dsp.setJaxbElement(new CTSettings()); dsp.setOverrideTableStyleFontSizeAndJustification(true);
DocumentSettingsPart dsp = wmlPackage.getMainDocumentPart().getDocumentSettingsPart(); if (dsp==null) { dsp = new DocumentSettingsPart(); wmlPackage.getMainDocumentPart().addTargetPart(dsp); dsp.setContents( Context.getWmlObjectFactory().createCTSettings() ); = dsp.getWordCompatSetting("overrideTableStyleFontSizeAndJustification"); if (styleRenamer.overrideTableStyleFontSizeAndJustification==null) { styleRenamer.overrideTableStyleFontSizeAndJustification=defaultSetting; dsp.setWordCompatSetting("overrideTableStyleFontSizeAndJustification", "1");
/** * Get a compatibility setting in the Word namespace, by name * @param name * @return * @throws Docx4JException */ public CTCompatSetting getWordCompatSetting(String name) { CTCompat compat = this.getJaxbElement().getCompat(); if (compat==null) { log.warn("No w:settings/w:compat element"); return null; } /* w:name="overrideTableStyleFontSizeAndJustification" * w:uri="http://schemas.microsoft.com/office/word" * w:val="1" */ CTCompatSetting theSetting = null; for (CTCompatSetting setting : compat.getCompatSetting() ) { if (setting.getUri().equals("http://schemas.microsoft.com/office/word") && setting.getName().equals(name)) { theSetting = setting; break; } } return theSetting; }
public Part CreateDocumentSettingsPartObject(String partName) throws InvalidFormatException { return new DocumentSettingsPart(new PartName(partName)); }
if (this.getJaxbElement()==null) { this.jaxbElement=new CTSettings(); RelationshipsPart rp = this.getRelationshipsPart(true); CTRel relId = getJaxbElement().getAttachedTemplate(); if (relId==null) { relId = Context.getWmlObjectFactory().createCTRel(); new QName("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "attachedTemplate"), CTRel.class, null, relId); this.getJaxbElement().setAttachedTemplate(je.getValue());
public DocumentSettingsPart() throws InvalidFormatException { super(new PartName("/word/settings.xml")); init(); }
/** * Get the value of compatSetting overrideTableStyleFontSizeAndJustification * * @since 3.3.0 */ public boolean overrideTableStyleFontSizeAndJustification() { CTCompatSetting overrideTableStyleFontSizeAndJustification = this.getWordCompatSetting("overrideTableStyleFontSizeAndJustification"); // false is the default, though Word 2010/13/16 set it to true if (overrideTableStyleFontSizeAndJustification==null || overrideTableStyleFontSizeAndJustification.getVal()==null) return false; return ( overrideTableStyleFontSizeAndJustification.getVal().equals("1") || overrideTableStyleFontSizeAndJustification.getVal().toLowerCase().equals("true") || overrideTableStyleFontSizeAndJustification.getVal().toLowerCase().equals("yes") ); }