gpt4 book ai didi

org.apache.poi.xslf.usermodel.XSLFSlideShow类的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 03:26:46 28 4
gpt4 key购买 nike

本文整理了Java中org.apache.poi.xslf.usermodel.XSLFSlideShow类的一些代码示例,展示了XSLFSlideShow类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSLFSlideShow类的具体详情如下:
包路径:org.apache.poi.xslf.usermodel.XSLFSlideShow
类名称:XSLFSlideShow

XSLFSlideShow介绍

[英]Experimental class to do low level processing of pptx files. Most users should use the higher level XMLSlideShow instead. If you are using these low level classes, then you will almost certainly need to refer to the OOXML specifications from http://www.ecma-international.org/publications/standards/Ecma-376.htm WARNING - APIs expected to change rapidly
[中]实验班做pptx文件的底层处理。大多数用户应该使用更高级别的XMLSlideShow。如果您使用的是这些低级类,那么几乎肯定需要参考http://www.ecma-international.org/publications/standards/Ecma-376.htm警告-预计API将迅速变化

代码示例

代码示例来源:origin: org.apache.poi/poi-ooxml

public XSLFPowerPointExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
  this(new XSLFSlideShow(container));
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Returns the low level slide object from
 *  the supplied slide reference
 */
@Internal
public CTSlide getSlide(CTSlideIdListEntry slide) throws IOException, XmlException {
  PackagePart slidePart = getSlidePart(slide);
  SldDocument slideDoc =
    SldDocument.Factory.parse(slidePart.getInputStream(), DEFAULT_XML_OPTIONS);
  return slideDoc.getSld();
}

代码示例来源:origin: org.apache.poi/poi-ooxml

public XSLFSlideShow(OPCPackage container) throws OpenXML4JException, IOException, XmlException {
  super(container);
  if(getCorePart().getContentType().equals(XSLFRelation.THEME_MANAGER.getContentType())) {
    rebase(getPackage());
  }
  presentationDoc =
    PresentationDocument.Factory.parse(getCorePart().getInputStream(), DEFAULT_XML_OPTIONS);
  embedds = new LinkedList<>();
  for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
    PackagePart corePart = getCorePart();
    PackagePart slidePart = corePart.getRelatedPart(corePart.getRelationship(ctSlide.getId2()));
    for(PackageRelationship rel : slidePart.getRelationshipsByType(OLE_OBJECT_REL_TYPE)) {
      if (TargetMode.EXTERNAL == rel.getTargetMode()) {
        continue;
      }
      // TODO: Add this reference to each slide as well
      embedds.add(slidePart.getRelatedPart(rel));
    }
    for (PackageRelationship rel : slidePart.getRelationshipsByType(PACK_OBJECT_REL_TYPE)) {
      embedds.add(slidePart.getRelatedPart(rel));
    }
  }
}
public XSLFSlideShow(String file) throws OpenXML4JException, IOException, XmlException {

代码示例来源:origin: apache/tika

XSLFSlideShow document = null;
try {
  document = new XSLFSlideShow(extractor.getPackage());
} catch (Exception e) {
  throw new TikaException(e.getMessage()); // Shouldn't happen
CTSlideIdList ctSlideIdList = document.getSlideReferences();
if (ctSlideIdList != null) {
  for (int i = 0; i < ctSlideIdList.sizeOfSldIdArray(); i++) {
      slidePart = document.getSlidePart(ctSlide);
    } catch (IOException e) {
      throw new TikaException("Broken OOXML file", e);
parts.add(document.getPackagePart());
    HANDOUT_MASTER}) {
  try {
    PackageRelationshipCollection prc = document.getPackagePart().getRelationshipsByType(rel);
    for (int i = 0; i < prc.size(); i++) {
      PackagePart pp = document.getPackagePart().getRelatedPart(prc.getRelationship(i));
      if (pp != null) {
        parts.add(pp);

代码示例来源:origin: com.qwazr/qwazr-library-poi

@Override
public void parseContent(final MultivaluedMap<String, String> parameters, final Path filePath,
    final String extension, final String mimeType, final ParserResultBuilder resultBuilder) throws Exception {
  final XSLFSlideShow pptSlideShow = new XSLFSlideShow(filePath.toAbsolutePath().toString());
  final XMLSlideShow slideshow = new XMLSlideShow(pptSlideShow.getPackage());
  final ParserFieldsBuilder metas = resultBuilder.metas();
  metas.set(MIME_TYPE, findMimeType(extension, mimeType, this::findMimeTypeUsingDefault));
  // Extract metadata
  try (XSLFPowerPointExtractor poiExtractor = new XSLFPowerPointExtractor(slideshow)) {
    final CoreProperties info = poiExtractor.getCoreProperties();
    if (info != null) {
      metas.add(TITLE, info.getTitle());
      metas.add(CREATOR, info.getCreator());
      metas.add(SUBJECT, info.getSubject());
      metas.add(DESCRIPTION, info.getDescription());
      metas.add(KEYWORDS, info.getKeywords());
      metas.add(CREATION_DATE, info.getCreated());
      metas.add(MODIFICATION_DATE, info.getModified());
    }
  }
  extractSides(slideshow, resultBuilder);
}

代码示例来源:origin: org.apache.poi/poi-ooxml

public XSLFPowerPointExtractor(XSLFSlideShow slideShow) {
  this(new XMLSlideShow(slideShow.getPackage()));
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Returns the references from the presentation to its
 *  slides.
 * You'll need these to figure out the slide ordering,
 *  and to get at the actual slides themselves
 */
@Internal
public CTSlideIdList getSlideReferences() {
  if(! getPresentation().isSetSldIdLst()) {
    getPresentation().setSldIdLst(CTSlideIdList.Factory.newInstance());
  }
  return getPresentation().getSldIdLst();
}

代码示例来源:origin: org.apache.poi/poi-ooxml

public PackagePart getSlidePart(CTSlideIdListEntry slide) throws IOException, XmlException {
  try {
    PackagePart corePart = getCorePart();
    return corePart.getRelatedPart(corePart.getRelationship(slide.getId2()));
  } catch(InvalidFormatException e) {
    throw new XmlException(e);
  }
}
/**

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Returns the low level slide master object from
 *  the supplied slide master reference
 */
@Internal
public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException {
  PackagePart masterPart = getSlideMasterPart(master);
  SldMasterDocument masterDoc =
    SldMasterDocument.Factory.parse(masterPart.getInputStream(), DEFAULT_XML_OPTIONS);
  return masterDoc.getSldMaster();
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Returns the low level notes object for the given
 *  slide, as found from the supplied slide reference
 */
@Internal
public CTNotesSlide getNotes(CTSlideIdListEntry slide) throws IOException, XmlException {
  PackagePart notesPart = getNodesPart(slide);
  if(notesPart == null)
    return null;
  NotesDocument notesDoc =
    NotesDocument.Factory.parse(notesPart.getInputStream(), DEFAULT_XML_OPTIONS);
  return notesDoc.getNotes();
}

代码示例来源:origin: com.github.lafa.tikaNoExternal/tika-parsers

XSLFSlideShow document = null;
try {
  document = new XSLFSlideShow(extractor.getPackage());
} catch (Exception e) {
  throw new TikaException(e.getMessage()); // Shouldn't happen
CTSlideIdList ctSlideIdList = document.getSlideReferences();
if (ctSlideIdList != null) {
  for (int i = 0; i < ctSlideIdList.sizeOfSldIdArray(); i++) {
      slidePart = document.getSlidePart(ctSlide);
    } catch (IOException e) {
      throw new TikaException("Broken OOXML file", e);
parts.add(document.getPackagePart());
    HANDOUT_MASTER}) {
  try {
    PackageRelationshipCollection prc = document.getPackagePart().getRelationshipsByType(rel);
    for (int i = 0; i < prc.size(); i++) {
      PackagePart pp = document.getPackagePart().getRelatedPart(prc.getRelationship(i));
      if (pp != null) {
        parts.add(pp);

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public XSLFPowerPointExtractor(XSLFSlideShow slideShow) {
  this(new XMLSlideShow(slideShow.getPackage()));
}

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Returns the references from the presentation to its
 *  slide masters.
 * You'll need these to get at the actual slide
 *  masters themselves
 */
@Internal
public CTSlideMasterIdList getSlideMasterReferences() {
  return getPresentation().getSldMasterIdLst();
}

代码示例来源:origin: org.apache.poi/poi-ooxml

public PackagePart getSlideMasterPart(CTSlideMasterIdListEntry master) throws IOException, XmlException {
  try {
    PackagePart corePart = getCorePart();
    return corePart.getRelatedPart(
      corePart.getRelationship(master.getId2())
    );
  } catch(InvalidFormatException e) {
    throw new XmlException(e);
  }
}
/**

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Returns the low level slide master object from
 *  the supplied slide master reference
 */
@Internal
public CTSlideMaster getSlideMaster(CTSlideMasterIdListEntry master) throws IOException, XmlException {
  PackagePart masterPart = getSlideMasterPart(master);
  SldMasterDocument masterDoc =
    SldMasterDocument.Factory.parse(masterPart.getInputStream(), DEFAULT_XML_OPTIONS);
  return masterDoc.getSldMaster();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Returns the low level notes object for the given
 *  slide, as found from the supplied slide reference
 */
@Internal
public CTNotesSlide getNotes(CTSlideIdListEntry slide) throws IOException, XmlException {
  PackagePart notesPart = getNodesPart(slide);
  if(notesPart == null)
    return null;
  NotesDocument notesDoc =
    NotesDocument.Factory.parse(notesPart.getInputStream(), DEFAULT_XML_OPTIONS);
  return notesDoc.getNotes();
}

代码示例来源:origin: org.apache.tika/tika-parsers

XSLFSlideShow document = null;
try {
  document = new XSLFSlideShow(extractor.getPackage());
} catch (Exception e) {
  throw new TikaException(e.getMessage()); // Shouldn't happen
CTSlideIdList ctSlideIdList = document.getSlideReferences();
if (ctSlideIdList != null) {
  for (int i = 0; i < ctSlideIdList.sizeOfSldIdArray(); i++) {
      slidePart = document.getSlidePart(ctSlide);
    } catch (IOException e) {
      throw new TikaException("Broken OOXML file", e);
parts.add(document.getPackagePart());
    HANDOUT_MASTER}) {
  try {
    PackageRelationshipCollection prc = document.getPackagePart().getRelationshipsByType(rel);
    for (int i = 0; i < prc.size(); i++) {
      PackagePart pp = document.getPackagePart().getRelatedPart(prc.getRelationship(i));
      if (pp != null) {
        parts.add(pp);

代码示例来源:origin: org.apache.poi/poi-ooxml

public static void main(String[] args) throws Exception {
  if (args.length < 1) {
    System.err.println("Use:");
    System.err.println("  XSLFPowerPointExtractor <filename.pptx>");
    System.exit(1);
  }
  POIXMLTextExtractor extractor =
      new XSLFPowerPointExtractor(
          new XSLFSlideShow(args[0]));
  System.out.println(extractor.getText());
  extractor.close();
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public XSLFSlideShow(OPCPackage container) throws OpenXML4JException, IOException, XmlException {
  super(container);
  if(getCorePart().getContentType().equals(XSLFRelation.THEME_MANAGER.getContentType())) {
    rebase(getPackage());
  }
  presentationDoc =
    PresentationDocument.Factory.parse(getCorePart().getInputStream(), DEFAULT_XML_OPTIONS);
  embedds = new LinkedList<>();
  for (CTSlideIdListEntry ctSlide : getSlideReferences().getSldIdArray()) {
    PackagePart corePart = getCorePart();
    PackagePart slidePart = corePart.getRelatedPart(corePart.getRelationship(ctSlide.getId2()));
    for(PackageRelationship rel : slidePart.getRelationshipsByType(OLE_OBJECT_REL_TYPE)) {
      if (TargetMode.EXTERNAL == rel.getTargetMode()) {
        continue;
      }
      // TODO: Add this reference to each slide as well
      embedds.add(slidePart.getRelatedPart(rel));
    }
    for (PackageRelationship rel : slidePart.getRelationshipsByType(PACK_OBJECT_REL_TYPE)) {
      embedds.add(slidePart.getRelatedPart(rel));
    }
  }
}
public XSLFSlideShow(String file) throws OpenXML4JException, IOException, XmlException {

代码示例来源:origin: org.apache.poi/poi-ooxml

/**
 * Gets the PackagePart of the notes for the
 *  given slide, or null if there isn't one.
 */
public PackagePart getNodesPart(CTSlideIdListEntry parentSlide) throws IOException, XmlException {
  PackageRelationshipCollection notes;
  PackagePart slidePart = getSlidePart(parentSlide);
  try {
    notes = slidePart.getRelationshipsByType(XSLFRelation.NOTES.getRelation());
  } 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());
  }
  try {
    return slidePart.getRelatedPart(notes.getRelationship(0));
  } catch(InvalidFormatException e) {
    throw new IllegalStateException(e);
  }
}
/**

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com