Examples of createPart()


Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

     
      /* manually assemble a new image package part*/
      OPCPackage opcPckg = doc.getPackage();
      XWPFRelation jpgRelation = XWPFRelation.IMAGE_JPEG;
      PackagePartName partName = PackagingURIHelper.createPartName(jpgRelation.getDefaultFileName().replace('#', '2'));
        PackagePart newImagePart = opcPckg.createPart(partName, jpgRelation.getContentType());
        byte[] nature1 = XWPFTestDataSamples.getImage("abstract4.jpg");
        OutputStream os = newImagePart.getOutputStream();
        os.write(nature1);
      os.close();
      XWPFHeader xwpfHeader = doc.getHeaderList().get(0);
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // 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){
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // Main part
            PackagePartName corePartName = PackagingURIHelper.createPartName(XWPFRelation.DOCUMENT.getDefaultFileName());
            // Create main part relationship
            pkg.addRelationship(corePartName, TargetMode.INTERNAL, PackageRelationshipTypes.CORE_DOCUMENT);
            // Create main document part
            pkg.createPart(corePartName, XWPFRelation.DOCUMENT.getContentType());

            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);

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

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // Main part
            PackagePartName corePartName = PackagingURIHelper.createPartName(XWPFRelation.DOCUMENT.getDefaultFileName());
            // Create main part relationship
            pkg.addRelationship(corePartName, TargetMode.INTERNAL, PackageRelationshipTypes.CORE_DOCUMENT);
            // Create main document part
            pkg.createPart(corePartName, XWPFRelation.DOCUMENT.getContentType());

            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);

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

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

        OPCPackage pkg = getPackagePart().getPackage();
        if(!pkg.containPart(srcPafrt.getPartName())){
            PackageRelationship rel = getPackagePart().addRelationship(
                    srcPafrt.getPartName(), TargetMode.INTERNAL, srcRel.getRelationshipType());

            PackagePart part = pkg.createPart(srcPafrt.getPartName(), srcPafrt.getContentType());
            OutputStream out = part.getOutputStream();
            try {
                InputStream is = srcPafrt.getInputStream();
                IOUtils.copy(is, out);
                out.close();
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // 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){
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

     
      /* manually assemble a new image package part*/
      OPCPackage opcPckg = doc.getPackage();
      XWPFRelation jpgRelation = XWPFRelation.IMAGE_JPEG;
      PackagePartName partName = PackagingURIHelper.createPartName(jpgRelation.getDefaultFileName().replace('#', '2'));
        PackagePart newImagePart = opcPckg.createPart(partName, jpgRelation.getContentType());
        byte[] nature1 = XWPFTestDataSamples.getImage("abstract4.jpg");
        OutputStream os = newImagePart.getOutputStream();
        os.write(nature1);
      os.close();
      XWPFHeader xwpfHeader = doc.getHeaderList().get(0);
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // 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){
View Full Code Here

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // Main part
            PackagePartName corePartName = PackagingURIHelper.createPartName(XWPFRelation.DOCUMENT.getDefaultFileName());
            // Create main part relationship
            pkg.addRelationship(corePartName, TargetMode.INTERNAL, PackageRelationshipTypes.CORE_DOCUMENT);
            // Create main document part
            pkg.createPart(corePartName, XWPFRelation.DOCUMENT.getContentType());

            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);

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

Examples of org.apache.poi.openxml4j.opc.OPCPackage.createPart()

            // 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){
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.