Package org.openxml4j.opc

Examples of org.openxml4j.opc.PackagePart


    super(container, MAIN_CONTENT_TYPE);
   
    workbookDoc =
      WorkbookDocument.Factory.parse(basePart.getInputStream());
   
    PackagePart ssPart = getSinglePartByRelationType(SHARED_STRINGS_RELATION_TYPE, basePart);
    if (ssPart != null) {
      sharedStrings = new SharedStringsTable(ssPart);
    } else {
     
    }
View Full Code Here


  /**
   * Returns the low level (work)sheet object from
   *  the supplied sheet reference
   */
  public CTWorksheet getSheet(CTSheet sheet) throws IOException, XmlException {
    PackagePart sheetPart =
      getRelatedPackagePart(sheet.getId());
    WorksheetDocument sheetDoc =
      WorksheetDocument.Factory.parse(sheetPart.getInputStream());
    return sheetDoc.getWorksheet();
  }
View Full Code Here

      relName = PackagingURIHelper.createPartName(rel.getTargetURI());
    } catch(InvalidFormatException e) {
      throw new InternalError(e.getMessage());
    }
   
    PackagePart part = container.getPart(relName);
    if(part == null) {
      throw new IllegalArgumentException("No part found for rel " + rel);
    }
    return part;
  }
View Full Code Here

 
  /**
   * Get the core document properties (core ooxml properties).
   */
  public PackagePropertiesPart getCoreProperties() throws OpenXML4JException, XmlException, IOException {
    PackagePart propsPart = getSinglePartByRelationType(CORE_PROPERTIES_REL_TYPE);
    if(propsPart == null) {
      return null;
    }
    return (PackagePropertiesPart)propsPart;
  }
View Full Code Here

 
  /**
   * Get the extended document properties (extended ooxml properties)
   */
  public CTProperties getExtendedProperties() throws OpenXML4JException, XmlException, IOException {
    PackagePart propsPart = getSinglePartByRelationType(EXTENDED_PROPERTIES_REL_TYPE);
   
    PropertiesDocument props = PropertiesDocument.Factory.parse(
        propsPart.getInputStream());
    return props.getProperties();
  }
View Full Code Here

  /**
   * Returns the low level slide master object from
   *  the supplied slide master reference
   */
  public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException {
    PackagePart masterPart =
      getRelatedPackagePart(master.getId2());
    SldMasterDocument masterDoc =
      SldMasterDocument.Factory.parse(masterPart.getInputStream());
    return masterDoc.getSldMaster();
  }
View Full Code Here

  /**
   * Returns the low level slide object from
   *  the supplied slide reference
   */
  public CTSlide getSlide(CTSlideIdListEntry slide) throws IOException, XmlException {
    PackagePart slidePart =
      getRelatedPackagePart(slide.getId2());
    SldDocument slideDoc =
      SldDocument.Factory.parse(slidePart.getInputStream());
    return slideDoc.getSld();
  }
View Full Code Here

  /**
   * Returns the low level notes object for the given
   *  slide, as found from the supplied slide reference
   */
  public CTNotesSlide getNotes(CTSlideIdListEntry slide) throws IOException, XmlException {
    PackagePart slidePart =
      getRelatedPackagePart(slide.getId2());
   
    PackageRelationshipCollection notes;
    try {
      notes = slidePart.getRelationshipsByType(NOTES_RELATION_TYPE);
    } catch(InvalidFormatException e) {
      throw new IllegalStateException(e);
    }
   
    if(notes.size() == 0) {
      // No notes for this slide
      return null;
    }
    if(notes.size() > 1) {
      throw new IllegalStateException("Expecting 0 or 1 notes for a slide, but found " + notes.size());
    }
   
    PackagePart notesPart =
      getPackagePart(notes.getRelationship(0));
    NotesDocument notesDoc =
      NotesDocument.Factory.parse(notesPart.getInputStream());
   
    return notesDoc.getNotes();
  }
View Full Code Here

   
    presentationDoc =
      PresentationDocument.Factory.parse(getCorePart().getInputStream());
   
    for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
            PackagePart slidePart =
                  getTargetPart(getCorePart().getRelationship(ctSlide.getId2()));
           
            for(PackageRelationship rel : slidePart.getRelationshipsByType(OLE_OBJECT_REL_TYPE))
                embedds.add(getTargetPart(rel)); // TODO: Add this reference to each slide as well
           
            for(PackageRelationship rel : slidePart.getRelationshipsByType(PACK_OBJECT_REL_TYPE))
                  embedds.add(getTargetPart(rel));
    }
  }
View Full Code Here

   * Returns the low level slide master object from
   *  the supplied slide master reference
   */
  public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException {
    try {
      PackagePart masterPart =
        getTargetPart(getCorePart().getRelationship(master.getId2()));
       
      SldMasterDocument masterDoc =
        SldMasterDocument.Factory.parse(masterPart.getInputStream());
      return masterDoc.getSldMaster();
    } catch(InvalidFormatException e) {
      throw new XmlException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.openxml4j.opc.PackagePart

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.