Package org.docx4j.openpackaging.parts

Examples of org.docx4j.openpackaging.parts.PartName


    super(partName);
    init();
  }

  public SlideMasterPart() throws InvalidFormatException {
    super(new PartName("/ppt/slideMasters/slideMaster1.xml"));
    init();
  }
View Full Code Here


    // Need references to these parts to create a slide
    // Please note that these parts *already exist* - they are
    // created by createPackage() above.  See that method
    // for instruction on how to create and add a part.
    MainPresentationPart pp = (MainPresentationPart)pMLPackage.getParts().getParts().get(
        new PartName("/ppt/presentation.xml"));   
    SlideLayoutPart layoutPart = (SlideLayoutPart)pMLPackage.getParts().getParts().get(
        new PartName("/ppt/slideLayouts/slideLayout1.xml"));
   
    // OK, now we can create a slide
    SlidePart slidePart = pMLPackage.createSlidePart(pp, layoutPart,
        new PartName("/ppt/slides/slide1.xml"));
               
    // Layout part
    DiagramLayoutPart layout = new DiagramLayoutPart(new PartName("/ppt/diagrams.layout1.xml"));
    layout.setJaxbElement(diagramLayoutObj);

    DiagramColorsPart colors = new DiagramColorsPart(new PartName("/ppt/diagrams.colors1.xml"));
    colors.unmarshal("colorsDef-accent1_2.xml");
    //colors.CreateMinimalContent("mycolors");
   
    DiagramStylePart style = new DiagramStylePart(new PartName("/ppt/diagrams.quickStyle1.xml"));
    style.unmarshal("quickStyle-simple1.xml");
    //style.CreateMinimalContent("mystyle");
   
    // DiagramDataPart
    DiagramDataPart data = new DiagramDataPart(new PartName("/ppt/diagrams.data1.xml"));
    data.setPackage(pMLPackage); // otherwise we need to pass pkg around
    data.setJaxbElement( createDiagramData(data, xml) );
   
    String layoutRelId = slidePart.addTargetPart(layout).getId();
    String dataRelId = slidePart.addTargetPart(data).getId();
View Full Code Here

    super(partName);
    init();
  }

  public CommentAuthorsPart() throws InvalidFormatException {
    super(new PartName("/ppt/commentAuthors.xml"));
    init();
  }
View Full Code Here

    super(partName);
    init();
  }

  public Chart() throws InvalidFormatException {
    super(new PartName("/word/charts/chart1.xml"))// In a .xlsx could be "/xl/charts/chart1.xml"?
    init();
  }
View Full Code Here

    super(partName);
    init();
  }

  public HandoutMasterPart() throws InvalidFormatException {
    super(new PartName("ppt/handoutMasters/handoutMaster1.xml"));
    init();
  }
View Full Code Here

    super(partName);
    setJAXBContext(Context.jcPML);           
  }

  public JaxbPmlPart() throws InvalidFormatException {
    super(new PartName("/ppt/presentation.xml"));
    setJAXBContext(Context.jcPML);           
  }
View Full Code Here

    if (contentType.equals(ContentTypes.PRESENTATIONML_MAIN)
        || contentType.equals(ContentTypes.PRESENTATIONML_TEMPLATE)
        || contentType.equals(ContentTypes.PRESENTATIONML_MACROENABLED)
        || contentType.equals(ContentTypes.PRESENTATIONML_TEMPLATE_MACROENABLED)
        ) {
      return new MainPresentationPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_SLIDE)) {
      return new SlidePart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_SLIDE_MASTER)) {
      return new SlideMasterPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_SLIDE_LAYOUT)) {
      return new SlideLayoutPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_COMMENTS)) {
      return new CommentsPart(new PartName(partName));     
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_TABLE_STYLES)) {
      return new TableStylesPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_PRES_PROPS)) {
      return new PresentationPropertiesPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_VIEW_PROPS)) {
      return new ViewPropertiesPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_TAGS)) {
      return new TagsPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_HANDOUT_MASTER)) {
      return new HandoutMasterPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_NOTES_MASTER)) {
      return new NotesMasterPart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_NOTES_SLIDE)) {
      return new NotesSlidePart(new PartName(partName));
    } else if (contentType.equals(ContentTypes.PRESENTATIONML_COMMENT_AUTHORS)) {
      return new CommentAuthorsPart(new PartName(partName));     
    } else {
      throw new PartUnrecognisedException("No subclass found for "
          + partName + " (content type '" + contentType + "')");         
    }
  } 
View Full Code Here

    super(partName);
    init();
  }

  public SlidePart() throws InvalidFormatException {
    super(new PartName("/ppt/slides/slide1.xml"));
    init();
  }
View Full Code Here

    super(partName);
    init();
  }

  public NotesSlidePart() throws InvalidFormatException {
    super(new PartName("/ppt/notesSlides/notesSlide1.xml"));
    init();
  }
View Full Code Here

          try {
            Unmarshaller u = Context.jc.createUnmarshaller();
            Object o = u.unmarshal( is );           
            log.info(o.getClass().getName());
           
            PartName name = part.getPartName();
           
            if (o instanceof CoverPageProperties) {
             
              part = new DocPropsCoverPagePart(name);             
              ((DocPropsCoverPagePart)part).setJaxbElement(
                  (CoverPageProperties)o);
             
            } else if (o instanceof org.opendope.conditions.Conditions) {
             
              part = new ConditionsPart(name);
              ((ConditionsPart)part).setJaxbElement(
                  (org.opendope.conditions.Conditions)o);             
             
            } else if (o instanceof org.opendope.xpaths.Xpaths) {
             
              part = new XPathsPart(name);
              ((XPathsPart)part).setJaxbElement(
                  (org.opendope.xpaths.Xpaths)o);

            } else if (o instanceof org.opendope.questions.Questionnaire) {
             
              part = new QuestionsPart(name);
              ((QuestionsPart)part).setJaxbElement(
                  (org.opendope.questions.Questionnaire)o);

            } else if (o instanceof org.opendope.answers.Answers) {
             
              part = new StandardisedAnswersPart(name);
              ((StandardisedAnswersPart)part).setJaxbElement(
                  (org.opendope.answers.Answers)o);
             
            } else if (o instanceof org.opendope.components.Components) {
             
              part = new ComponentsPart(name);
              ((ComponentsPart)part).setJaxbElement(
                  (org.opendope.components.Components)o);

            } else if (o instanceof JAXBElement<?>
                && XmlUtils.unwrap(o) instanceof org.docx4j.bibliography.CTSources) {
              part = new BibliographyPart(name);
              ((BibliographyPart) part)
                  .setJaxbElement((JAXBElement<org.docx4j.bibliography.CTSources>)o);

            } else {
             
              log.warn("No known part after all for CustomXmlPart " + o.getClass().getName());

              CustomXmlDataStorage data = getCustomXmlDataStorageClass().factory();         
              is.reset();
              data.setDocument(is); // Not necessarily JAXB, that's just our method name
              ((org.docx4j.openpackaging.parts.CustomXmlDataStoragePart)part).setData(data);           
             
            }
           
          } catch (javax.xml.bind.UnmarshalException ue) {
           
            // No ...
            CustomXmlDataStorage data = getCustomXmlDataStorageClass().factory()
            is.reset();
            data.setDocument(is); // Not necessarily JAXB, that's just our method name
            ((org.docx4j.openpackaging.parts.CustomXmlDataStoragePart)part).setData(data);           
          }         
                   
        } else {
          // Shouldn't happen, since ContentTypeManagerImpl should
          // return an instance of one of the above, or throw an
          // Exception.
         
          log.error("No suitable part found for: " + resolvedPartUri);
          return null;         
        }
      } catch (PartUnrecognisedException e) {
       
        // Try to get it as a binary part       
        part = new BinaryPart(new PartName("/" + resolvedPartUri));
        ((BinaryPart) part).setBinaryData(is);
         
      }
    } catch (Exception ex) {
      // PathNotFoundException, ValueFormatException, RepositoryException, URISyntaxException
View Full Code Here

TOP

Related Classes of org.docx4j.openpackaging.parts.PartName

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.