Package org.docx4j.convert.out.flatOpcXml

Examples of org.docx4j.convert.out.flatOpcXml.FlatOpcXmlCreator


  private ByteArrayOutputStream marshallFlatOPC(WordprocessingMLPackage wmlPkg) throws JAXBException, Docx4JException {

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
   
       // Create a org.docx4j.wml.Package object
    FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wmlPkg);
    org.docx4j.xmlPackage.Package pkg = worker.get();
     
      // Now marshall it
    JAXBContext jc = Context.jcXmlPackage;
    Marshaller marshaller=jc.createMarshaller();
   
View Full Code Here


  }
 
  public boolean saveFlatOPC(OutputStream realOS) throws Docx4JException {
   
    try {
      FlatOpcXmlCreator worker = new FlatOpcXmlCreator(p);
      org.docx4j.xmlPackage.Package pkg = worker.get();
     
      // Now marshall it
      JAXBContext jc = Context.jcXmlPackage;
      Marshaller marshaller=jc.createMarshaller();
     
View Full Code Here

    StartEvent startEvent = new StartEvent( this,  WellKnownProcessSteps.PKG_SAVE );
    startEvent.publish();
   
    if (flags == Docx4J.FLAG_SAVE_FLAT_XML) {
      JAXBContext jc = Context.jcXmlPackage;
      FlatOpcXmlCreator opcXmlCreator = new FlatOpcXmlCreator(this);
      org.docx4j.xmlPackage.Package pkg = opcXmlCreator.get();
      Marshaller marshaller;
      try {
        marshaller = jc.createMarshaller();
        NamespacePrefixMapperUtils.setProperty(marshaller,
            NamespacePrefixMapperUtils.getPrefixMapper());     
View Full Code Here

    public void transform(Templates xslt,
        Map<String, Object> transformParameters) throws Exception {

      // Prepare in the input document
     
    FlatOpcXmlCreator worker = new FlatOpcXmlCreator(this);
    org.docx4j.xmlPackage.Package pkg = worker.get();
     
    JAXBContext jc = Context.jcXmlPackage;
    Marshaller marshaller=jc.createMarshaller();
    org.w3c.dom.Document doc = org.docx4j.XmlUtils.neww3cDomDocument();
    marshaller.marshal(pkg, doc);
View Full Code Here

    if (save) {
      wordMLPackage.save(new java.io.File(inputfilepath) );
      System.out.println("Saved " + inputfilepath);
    } else {
         // Show the Flat OPC XML
      FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wordMLPackage);
      worker.marshal(System.out);
    }
   
    System.out.println("Done.");
       
  }
View Full Code Here

    Relationship relationship = createHeaderPart(wordMLPackage);
    // 2. an entry in SectPr
    createHeaderReference(wordMLPackage, relationship);

    // Display the result as Flat OPC XML
    FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wordMLPackage);
    worker.marshal(System.out);       
  }
View Full Code Here

      Object o;
      Document doc;
      if (useFlatOPC) {
        if (flatOPC==null) {
          // We must have started with a .docx
          FlatOpcXmlCreator worker = new FlatOpcXmlCreator(wordMLPackage);
          o = worker.get();
        } else {
          o = flatOPC;
        }
        doc = XmlUtils.marshaltoW3CDomDocument(o, Context.jcXmlPackage);
      } else {
View Full Code Here

        org.docx4j.wml.Document docxDoc = (org.docx4j.wml.Document) docxMdp.getJaxbElement();
        return docxDoc.getBody();
    }

    public static WordprocessingMLPackage clone(WordprocessingMLPackage docxTemplate) throws MergeException {
        FlatOpcXmlCreator foxc = new FlatOpcXmlCreator(docxTemplate);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            foxc.marshal(baos);
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            FlatOpcXmlImporter foxi = new FlatOpcXmlImporter(bais);
            docxTemplate = (WordprocessingMLPackage) foxi.get();
        } catch (Docx4JException e) {
            throw new MergeException("unable to defensive copy (problem exporting)", e);
View Full Code Here

        org.docx4j.wml.Document docxDoc = (org.docx4j.wml.Document) docxMdp.getJaxbElement();
        return docxDoc.getBody();
    }

    public static WordprocessingMLPackage clone(WordprocessingMLPackage docxTemplate) throws MergeException {
        FlatOpcXmlCreator foxc = new FlatOpcXmlCreator(docxTemplate);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            foxc.marshal(baos);
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            FlatOpcXmlImporter foxi = new FlatOpcXmlImporter(bais);
            docxTemplate = (WordprocessingMLPackage) foxi.get();
        } catch (Docx4JException e) {
            throw new MergeException("unable to defensive copy (problem exporting)", e);
View Full Code Here

TOP

Related Classes of org.docx4j.convert.out.flatOpcXml.FlatOpcXmlCreator

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.