Examples of OdfPackage


Examples of org.odftoolkit.odfdom.pkg.OdfPackage

   *      or NULL if the media type is not supported by ODFDOM.
   * @throws java.lang.Exception - if the document could not be created.
   */
  protected static OdfDocument loadTemplate(Resource res, OdfMediaType odfMediaType) throws Exception {
    InputStream in = res.createInputStream();
    OdfPackage pkg = null;
    try {
      pkg = OdfPackage.loadPackage(in);
    } finally {
      in.close();
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfPackage

  }
 
  private boolean _validate(Logger aLogger) throws ODFValidatorException {
    boolean bHasErrors = false;

    OdfPackage aPkg = getPackage(aLogger);
    if (aPkg == null) {
      return true;
    }

    try {
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfPackage

  }

  protected boolean validateEntry(XMLFilter aFilter,
      Validator aValidator, Logger aLogger,
      String aEntryName) throws IOException, ZipException, IllegalStateException, ODFValidatorException {
    OdfPackage aPkg = getPackage(aLogger);

    if (!aEntryName.equals(OdfPackage.OdfFile.MANIFEST.getPath()) && isEncrypted(aEntryName, aLogger)) {
      return false;
    }

    InputStream aInStream = null;
    try {
      aInStream = aPkg.getInputStream(aEntryName, true);
    } catch (Exception e) {
      throw new ODFValidatorException(e);
    }

View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfPackage

  }

  protected boolean parseEntry(XMLFilter aFilter,
      Logger aLogger,
      String aEntryName, boolean bValidating) throws IOException, ZipException, IllegalStateException, ODFValidatorException {
    OdfPackage aPkg = getPackage(aLogger);

    if (isEncrypted(aEntryName, aLogger)) {
      return false;
    }
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfPackage

  private String getVersion(Logger aLogger) throws ODFValidatorException {
    String aVersion = null;

    InputStream aInStream = null;
    try {
      OdfPackage aPkg = getPackage(aLogger);
      aInStream = aPkg.getInputStream(getStreamName(OdfDocument.OdfXMLFile.META.getFileName()), true);
      if (aInStream == null) {
        aInStream = aPkg.getInputStream(getStreamName(OdfDocument.OdfXMLFile.SETTINGS.getFileName()), true);
      }
      if (aInStream == null) {
        aInStream = aPkg.getInputStream(getStreamName(OdfDocument.OdfXMLFile.CONTENT.getFileName()), true);
      }
      if (aInStream == null) {
        return null;
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.odftoolkit.odfdom.pkg.OdfPackage

      /////////////////////////////////////////
      // ODFDOM PACKAGE LAYER - WIKI EXAMPLE //
      /////////////////////////////////////////

      // loads the ODF document package from the path
      OdfPackage pkg = OdfPackage.loadPackage(ResourceUtilities.getTestResourceAsStream("TestEmpty_OdfTextDocument.odt"));

      // loads the images from the URLs and inserts the image in the package, adapting the manifest
      pkg.insert(ResourceUtilities.getURI(TEST_PIC), "Pictures/" + TEST_PIC, null);
      //Deactivated as test fail, when test machine is not online (painful for offline work)
      //pkg.insert(new URI("http://odftoolkit.org/attachments/wiki_images/odftoolkit/Table_fruits_diagramm.jpg"), "someweiredname/tableandfruits.jpg", null);
      pkg.save(ResourceUtilities.newTestOutputFile("odfdom-wiki-package.odt"));


      /////////////////////////////////////
      // ODFDOM XML LAYER - WIKI EXAMPLE //
      /////////////////////////////////////
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.