Examples of OPCPackage


Examples of org.apache.poi.openxml4j.opc.OPCPackage

    /**
     * Create a new SpreadsheetML package and setup the default minimal content
     */
    protected static OPCPackage newPackage() {
        try {
            OPCPackage pkg = OPCPackage.create(new ByteArrayOutputStream());
            // Main part
            PackagePartName corePartName = PackagingURIHelper.createPartName(XSSFRelation.WORKBOOK.getDefaultFileName());
            // Create main part relationship
            pkg.addRelationship(corePartName, TargetMode.INTERNAL, PackageRelationshipTypes.CORE_DOCUMENT);
            // Create main document part
            pkg.createPart(corePartName, XSSFRelation.WORKBOOK.getContentType());

            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);

            return pkg;
        } catch (Exception e){
            throw new POIXMLException(e);
        }
View Full Code Here

Examples of org.docx4j.openpackaging.packages.OpcPackage

    }
   
     
    // Load the Package as an OpcPackage, since this
    // works for docx, pptx, and xlsx
    OpcPackage opcPackage = OpcPackage.load(new java.io.File(inputfilepath));   
   
    if (printContentTypes)
      printContentTypes(opcPackage);
   
    // List the parts by walking the rels tree
    RelationshipsPart rp = opcPackage.getRelationshipsPart();
    StringBuilder sb = new StringBuilder();
    printInfo(rp, sb, "");
    traverseRelationships(opcPackage, rp, sb, "    ");
   
    System.out.println(sb.toString());
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.