Package org.apache.poi.openxml4j.exceptions

Examples of org.apache.poi.openxml4j.exceptions.InvalidOperationException


   * Validates the package compliance with the OPC specifications.
   *
   * @return <b>true</b> if the package is valid else <b>false</b>
   */
  public boolean validatePackage(OPCPackage pkg) throws InvalidFormatException {
    throw new InvalidOperationException("Not implemented yet !!!");
  }
View Full Code Here


  ZipPackage(String path, PackageAccess access) {
    super(access);

    ZipFile zipFile = ZipHelper.openZipFile(path);
    if (zipFile == null)
      throw new InvalidOperationException(
          "Can't open the specified file: '" + path + "'");
    this.zipArchive = new ZipFileZipEntrySource(zipFile);
  }
View Full Code Here

                    + targetFile.getAbsolutePath()
                    + "' cannot be deleted ! Make sure that no other application use it.");
          }
        }
      } else {
        throw new InvalidOperationException(
            "Can't close a package not previously open with the open() method !");
      }
    }
  }
View Full Code Here

    if (PackagingURIHelper.PACKAGE_ROOT_URI.getPath().equals(
                partName.getURI().getPath()) )
      return PackagingURIHelper.PACKAGE_RELATIONSHIPS_ROOT_PART_NAME;

    if (partName.isRelationshipPartURI())
      throw new InvalidOperationException("Can't be a relationship part");

    String fullPath = partName.getURI().getPath();
    String filename = getFilename(partName.getURI());
    fullPath = fullPath.substring(0, fullPath.length() - filename.length());
    fullPath = combine(fullPath,
View Full Code Here

  ZipPackage(String path, PackageAccess access) {
    super(access);

    ZipFile zipFile = ZipHelper.openZipFile(path);
    if (zipFile == null)
      throw new InvalidOperationException(
          "Can't open the specified file: '" + path + "'");
    this.zipArchive = new ZipFileZipEntrySource(zipFile);
  }
View Full Code Here

                    + targetFile.getAbsolutePath()
                    + "' cannot be deleted ! Make sure that no other application use it.");
          }
        }
      } else {
        throw new InvalidOperationException(
            "Can't close a package not previously open with the open() method !");
      }
    }
  }
View Full Code Here

  public static OPCPackage create(File file) {
    if (file == null || (file.exists() && file.isDirectory()))
      throw new IllegalArgumentException("file");

    if (file.exists()) {
      throw new InvalidOperationException(
          "This package (or file) already exists : use the open() method or delete the file.");
    }

    // Creates a new package
    OPCPackage pkg = null;
View Full Code Here

      try {
        thumbnailPartName = PackagingURIHelper
            .createPartName("/docProps/thumbnail"
                + path.substring(path.lastIndexOf(".") + 1));
      } catch (InvalidFormatException e2) {
        throw new InvalidOperationException(
            "Can't add a thumbnail file named '" + filename + "'");
      }
    }

    // Check if part already exist
    if (this.getPart(thumbnailPartName) != null)
      throw new InvalidOperationException(
          "You already add a thumbnail named '" + filename + "'");

    // Add the thumbnail part to this package.
    PackagePart thumbnailPart = this.createPart(thumbnailPartName,
        contentType, false);
View Full Code Here

   *             Throws if a writing operation is done on a read only package.
   * @see org.apache.poi.openxml4j.opc.PackageAccess
   */
  void throwExceptionIfReadOnly() throws InvalidOperationException {
    if (packageAccess == PackageAccess.READ)
      throw new InvalidOperationException(
          "Operation not allowed, document open in read only mode!");
  }
View Full Code Here

   *             Throws if a read operation is done on a write only package.
   * @see org.apache.poi.openxml4j.opc.PackageAccess
   */
  void throwExceptionIfWriteOnly() throws InvalidOperationException {
    if (packageAccess == PackageAccess.WRITE)
      throw new InvalidOperationException(
          "Operation not allowed, document open in write only mode!");
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.openxml4j.exceptions.InvalidOperationException

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.