Package org.docx4j.openpackaging.exceptions

Examples of org.docx4j.openpackaging.exceptions.Docx4JException


    try {
      OutputStream docxOut = docxFile.getContent().getOutputStream();
      success = _saveToZipFile.save(docxOut);
    } catch (FileSystemException exc) {
      exc.printStackTrace();
      throw new Docx4JException("Failed to save package", exc);
    }
   
    try {
      docxFile.close();
    } catch (FileSystemException exc) {
View Full Code Here


    FormattingResults formattingResults = null;
    FopFactory fopFactory = null;
    try {
      fopFactory = getFopFactory(apacheFopConfiguration);
    } catch (FOPException e) {
      throw new Docx4JException("Exception creating fop factory for rendering: " + e.getMessage(), e);
    }
    if (twoPass) {
      //1st pass in 2 pass
      log.debug("1st pass in 2 pass");
     
View Full Code Here

          //1 Pass
          new SAXResult(fop.getDefaultHandler()) :
          //2 Pass
          new SAXResult(new PlaceholderReplacementHandler(fop.getDefaultHandler(), placeholderLookup)));
    } catch (FOPException e) {
      throw new Docx4JException("Exception setting up result for fo transformation: " + e.getMessage(), e);
    }

    Transformer transformer;
    try {
      transformer = XmlUtils.getTransformerFactory().newTransformer();
      transformer.transform(foDocumentSrc, result);
    } catch (TransformerConfigurationException e) {
      throw new Docx4JException("Exception setting up transformer: " + e.getMessage(), e);
    } catch (TransformerException e) {
      throw new Docx4JException("Exception executing transformer: " + e.getMessage(), e);
    }
  }
View Full Code Here

    Result result = null;
    try {
      fop = fopFactory.newFop(outputFormat, new NullOutputStream());
      result = new SAXResult(new PlaceholderReplacementHandler(fop.getDefaultHandler(), placeholderLookup));
    } catch (FOPException e) {
      throw new Docx4JException("Exception setting up result for fo transformation: " + e.getMessage(), e);
    }

    Transformer transformer;
    try {
      transformer = XmlUtils.getTransformerFactory().newTransformer();
      transformer.transform(foDocumentSrc, result);
    } catch (TransformerConfigurationException e) {
      throw new Docx4JException("Exception setting up transformer: " + e.getMessage(), e);
    } catch (TransformerException e) {
      throw new Docx4JException("Exception executing transformer: " + e.getMessage(), e);
    }
    return fop.getResults();
  }
View Full Code Here

     
      List<PageSequenceResults> resultList = null;
      PageSequenceResults pageSequenceResults = null;
     
      if (formattingResults == null) {
        throw new Docx4JException("Apache fop returned no FormattingResults (null)");
      }
      else {
        resultList = formattingResults.getPageSequences();
        if (resultList == null) {
          throw new Docx4JException("Apache fop returned null pageSequences");
        }
        else if (resultList.size() != pageNumberInformation.size()) {
          throw new Docx4JException("Apache fop returned different count of sections than expected, returned: " + resultList.size() + ", expected: " + pageNumberInformation.size());
        }
      }
     
      putDocumentPageCount(formattingResults.getPageCount());
      for (int i=0; i<formattingResults.getPageSequences().size(); i++) {
View Full Code Here

        //part.unmarshal( ((org.w3c.dom.Document)result.getNode()).getDocumentElement() );
        return XmlUtils.unmarshal(((org.w3c.dom.Document)result.getNode()) );
      }
     
    } catch (Exception e) {
      throw new Docx4JException("Problems applying bindings", e);     
    }
  }
View Full Code Here

           
        org.docx4j.XmlUtils.transform(doc, xslt, transformParameters, result);
       
        part.setJaxbElement(result);
      } catch (Exception e) {
        throw new Docx4JException("Problems ensuring integrity", e);     
      }
         
    }
View Full Code Here

     try {
      DOMSource source = new DOMSource(doc);
       XmlUtils.getTransformerFactory().newTransformer().transform(source,
           new StreamResult(os) );
    } catch (Exception e) {
      throw new Docx4JException("Problems saving to OutputStream", e);
    }
   
  }
View Full Code Here

                try {
                        part.setJaxbElement(result);

                } catch (JAXBException e) {
                        throw new Docx4JException(
                                        "Error unmarshalling document part for SDT removal", e);
                }
        }
View Full Code Here

     
      // return the uri
      uri = setupImageUri(imageFile);
      log.info("Wrote @src='" + uri);
    } catch (IOException ioe) {
      throw new Docx4JException("Exception storing '" + filename + "', " + ioe.toString(), ioe);
    } finally {
      try {
        out.close();
      } catch (IOException ioe) {
        ioe.printStackTrace();
View Full Code Here

TOP

Related Classes of org.docx4j.openpackaging.exceptions.Docx4JException

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.