Package org.docx4j.openpackaging.parts.WordprocessingML

Examples of org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart


  }
 
 
  protected void setSetting(WordprocessingMLPackage wmlPackage, boolean val) throws Docx4JException {
   
      DocumentSettingsPart dsp = wmlPackage.getMainDocumentPart().getDocumentSettingsPart();
      if (dsp==null) {
        dsp = new DocumentSettingsPart();
        wmlPackage.getMainDocumentPart().addTargetPart(dsp);
       
        dsp.setContents( Context.getWmlObjectFactory().createCTSettings() );
      }

      if (val) {
        dsp.setWordCompatSetting("overrideTableStyleFontSizeAndJustification", "1");
      } else {
        dsp.setWordCompatSetting("overrideTableStyleFontSizeAndJustification", "0");       
      }
  }
View Full Code Here


    Theme theme = (Theme)XmlUtils.unmarshalString(themeXML);     
    themePart.setJaxbElement(theme);
    mdp.addTargetPart(themePart);
   
    // Settings
    DocumentSettingsPart dsp = new DocumentSettingsPart();
    dsp.setJaxbElement(createSettings());
    mdp.addTargetPart(dsp);
   
   
    Document document = (Document)XmlUtils.unmarshalString(documentXML);   
    wordMLPackage.getMainDocumentPart().setJaxbElement(document);   
View Full Code Here

    Theme theme = (Theme)XmlUtils.unmarshalString(themeXML);     
    themePart.setJaxbElement(theme);
    mdp.addTargetPart(themePart);
   
    // Settings
    DocumentSettingsPart dsp = new DocumentSettingsPart();
    dsp.setJaxbElement(createSettings());
    mdp.addTargetPart(dsp);
   
   
    Document document = (Document)XmlUtils.unmarshalString(documentXML);   
    wordMLPackage.getMainDocumentPart().setJaxbElement(document);   
View Full Code Here

    Theme theme = (Theme)XmlUtils.unmarshalString(themeXML);     
    themePart.setJaxbElement(theme);
    mdp.addTargetPart(themePart);
   
    // Settings
    DocumentSettingsPart dsp = new DocumentSettingsPart();
    dsp.setJaxbElement(createSettings());
    mdp.addTargetPart(dsp);
   
   
    Document document = (Document)XmlUtils.unmarshalString(documentXML);   
    wordMLPackage.getMainDocumentPart().setJaxbElement(document);   
View Full Code Here

    WordprocessingMLPackage pkg = wmlPackage;
    String decimalSymbol=null;
    if (pkg!=null
        && pkg.getMainDocumentPart().getDocumentSettingsPart()!=null) {
     
      DocumentSettingsPart docSettingsPart = pkg.getMainDocumentPart().getDocumentSettingsPart();
      if (docSettingsPart.getJaxbElement().getDecimalSymbol()!=null) {
        decimalSymbol = docSettingsPart.getJaxbElement().getDecimalSymbol().getVal();
      }
    }

    // For DOCPROPERTY field, and possibly some others, but not "=",
    // Word will parse "€180,000.00 EUR" as a number
View Full Code Here

    }
   
    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);
    }
View Full Code Here

    Theme theme = (Theme)XmlUtils.unmarshalString(themeXML);     
    themePart.setJaxbElement(theme);
    mdp.addTargetPart(themePart);
   
    // Settings
    DocumentSettingsPart dsp = new DocumentSettingsPart();
    dsp.setJaxbElement(createSettings());
    mdp.addTargetPart(dsp);
   
   
    Document document = (Document)XmlUtils.unmarshalString(documentXML);   
    wordMLPackage.getMainDocumentPart().setJaxbElement(document);   
View Full Code Here

    }
   
   
    if (attachTemplate) {
      // Create settings part, and init content
      DocumentSettingsPart dsp = new DocumentSettingsPart();
      CTSettings settings = Context.getWmlObjectFactory().createCTSettings();
      dsp.setJaxbElement(settings);
      wordMLPackage.getMainDocumentPart().addTargetPart(dsp);
     
      // Create external rel
      RelationshipsPart rp = RelationshipsPart.createRelationshipsPartForPart(dsp);    
      org.docx4j.relationships.Relationship rel = new org.docx4j.relationships.ObjectFactory().createRelationship();
View Full Code Here

    return new StyleDefinitionsPart(new PartName(partName));
  }

  public Part CreateDocumentSettingsPartObject(String partName)
      throws InvalidFormatException {
    return new DocumentSettingsPart(new PartName(partName));
  }
View Full Code Here

TOP

Related Classes of org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.