Package org.docx4j.openpackaging.parts.WordprocessingML

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


 
  protected WordprocessingMLPackage createPkg() throws Exception {

    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
   
    NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
    ndp.setContents((Numbering)XmlUtils.unmarshalString(numberingXml));
   
    wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
   
    wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart().setJaxbElement((Styles)XmlUtils.unmarshalString(stylesXml));
   
View Full Code Here


 
  final static String EXPECT_START="[expect]";
  final static String EXPECT_END="[/expect]"

  protected void testNumbering(WordprocessingMLPackage wordMLPackage) {
    NumberingDefinitionsPart ndp = wordMLPackage.getMainDocumentPart().getNumberingDefinitionsPart();
   
    Emulator listNumberingEmulator = ndp.getEmulator();
   
    // Iterate through the paragraphs
    int assertionCount=0;
    for (Object o : wordMLPackage.getMainDocumentPart().getContent() ) {
   
View Full Code Here

        org.docx4j.convert.in.FlatOpcXmlImporter xmlPackage = new org.docx4j.convert.in.FlatOpcXmlImporter( wmlPackageEl);

        WordprocessingMLPackage wmlPackage = (WordprocessingMLPackage)xmlPackage.get();
       
        // Get the Ind value
        NumberingDefinitionsPart ndp = wmlPackage.getMainDocumentPart().getNumberingDefinitionsPart();
        // Force initialisation of maps
        ndp.getEmulator();
       
        Ind ind = ndp.getInd("1", "0");
       
        if (ind!=null) {
          assertEquals( ind.getLeft().toString(), expected[i] );
          System.out.println( "<w:ind w:left='" + ind.getLeft().toString() + "\n\n" );
        } else {
View Full Code Here

 
  protected WordprocessingMLPackage createPkg() throws Exception {

    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
   
    NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
    ndp.setContents((Numbering)XmlUtils.unmarshalString(numbering));
   
    wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
   
    return wordMLPackage;
  }
View Full Code Here

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

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

  public static void main(String[] args) throws Exception {
   
    WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
   
    // Add numbering part
    NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
    wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
    ndp.setJaxbElement( (Numbering) XmlUtils.unmarshalString(initialNumbering) );
   
    // Add some document content
    wordMLPackage.getMainDocumentPart().addParagraphOfText("Example of restarting numbering");
   
    P p = createNumberedParagraph(1, 0, "text on top level" );
      wordMLPackage.getMainDocumentPart().addObject(p);
   
      wordMLPackage.getMainDocumentPart().addObject(
          createNumberedParagraph(1, 0, "more text on top level" ));
   
      wordMLPackage.getMainDocumentPart().addObject(
          createNumberedParagraph(1, 1, "text on level 1" ));
     
      // Ok, lets restart numbering
      long newNumId = ndp.restart(1, 0, 1);
     
      wordMLPackage.getMainDocumentPart().addObject(
          createNumberedParagraph(newNumId, 0, "text on top level - restarted" ));
     
      // After first using newNumId, it doesn't matter whether
View Full Code Here

      // Styles
      mdp.getStyleDefinitionsPart(true).setJaxbElement(transitionContainer.getStyles());
     
      // Numbering
      try {
        NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
        ndp.setJaxbElement(transitionContainer.getNumbering());
        mdp.addTargetPart(ndp);
       
        // fix attributes
        // <w:multiLevelType w:val="Multilevel"/> should start with lower case
        for (AbstractNum anum : ndp.getJaxbElement().getAbstractNum()) {
          if (anum.getMultiLevelType()==null) continue;
          String multiLevelType = anum.getMultiLevelType().getVal();
          multiLevelType = multiLevelType.substring(0, 1).toLowerCase() + multiLevelType.substring(1);
          anum.getMultiLevelType().setVal(multiLevelType);
        }
View Full Code Here

      IOUtils.ensurePathExists(workspace.getServerContext().getRealPath(File.separator), path);

      // Convierte el c�digo XHTML a DOCX
      WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();

      NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
      wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
      ndp.unmarshalDefaultNumbering();

      XHTMLImporterImpl xHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
      xHTMLImporter.setHyperlinkStyle("Hyperlink");

      InputStream stream = new ByteArrayInputStream(xhtml.getBytes());
View Full Code Here

TOP

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

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.