org.apache.poi.xslf.usermodel.XSLFSlide.getSlideShow()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(170)

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

XSLFSlide.getSlideShow介绍

暂无

代码示例

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

@Override
public int getSlideNumber() {
  int idx = getSlideShow().getSlides().indexOf(this);
  return (idx == -1) ? idx : idx+1;
}

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

/**
 * @return the comment authors part or {@code null} if there weren't any comments
 * @since POI 4.0.0
 */
@SuppressWarnings("WeakerAccess")
public XSLFCommentAuthors getCommentAuthorsPart() {
  if(_commentAuthors == null) {
    // first scan the slide relations
    for (POIXMLDocumentPart p : getRelations()) {
      if (p instanceof XSLFCommentAuthors) {
        _commentAuthors = (XSLFCommentAuthors)p;
        return _commentAuthors;
      }
    }
    // then scan the presentation relations
    for (POIXMLDocumentPart p : getSlideShow().getRelations()) {
      if (p instanceof XSLFCommentAuthors) {
        _commentAuthors = (XSLFCommentAuthors)p;
        return _commentAuthors;
      }
    }
  }
  return null;
}

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

/**
   * Gets the requested text from the slide
   *
   * @param slide       the slide to retrieve the text from
   * @param slideText   Should we retrieve text from slides?
   * @param notesText   Should we retrieve text from notes?
   * @param commentText Should we retrieve text from comments?
   * @param masterText  Should we retrieve text from master slides?
   * @return the extracted text
   */
  public static String getText(XSLFSlide slide, boolean slideText, boolean notesText, boolean commentText, boolean masterText) {
    final SlideShowExtractor<XSLFShape, XSLFTextParagraph> ex = new SlideShowExtractor<>(slide.getSlideShow());
    ex.setSlidesByDefault(slideText);
    ex.setNotesByDefault(notesText);
    ex.setCommentsByDefault(commentText);
    ex.setMasterByDefault(masterText);
    return ex.getText(slide);
  }
}

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

private void copyChart(CTGraphicalObjectData objData, XSLFGraphicFrame srcShape) {
  XSLFSlide slide = (XSLFSlide) getSheet();
  XSLFSheet src = srcShape.getSheet();
  String xpath = "declare namespace c='http://schemas.openxmlformats.org/drawingml/2006/chart' c:chart";
  XmlObject[] obj = objData.selectPath(xpath);
  if (obj != null && obj.length == 1) {
    XmlCursor c = obj[0].newCursor();
    try {
      // duplicate chart with embedded workbook
      QName idQualifiedName = new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id");
      String id = c.getAttributeText(idQualifiedName);
      XSLFChart srcChart = (XSLFChart) src.getRelationById(id);
      XSLFChart chartCopy = slide.getSlideShow().createChart(slide);
      chartCopy.importContent(srcChart);
      chartCopy.setWorkbook(srcChart.getWorkbook());
      c.setAttributeText(idQualifiedName, slide.getRelationId(chartCopy));
    } catch (InvalidFormatException e) {
      throw new POIXMLException(e);
    } catch (IOException e) {
      throw new POIXMLException(e);
    }
    c.dispose();
  }
}

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

@Override
public int getSlideNumber() {
  int idx = getSlideShow().getSlides().indexOf(this);
  return (idx == -1) ? idx : idx+1;
}

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

/**
 * @return the comment authors part or {@code null} if there weren't any comments
 * @since POI 4.0.0
 */
@SuppressWarnings("WeakerAccess")
public XSLFCommentAuthors getCommentAuthorsPart() {
  if(_commentAuthors == null) {
    // first scan the slide relations
    for (POIXMLDocumentPart p : getRelations()) {
      if (p instanceof XSLFCommentAuthors) {
        _commentAuthors = (XSLFCommentAuthors)p;
        return _commentAuthors;
      }
    }
    // then scan the presentation relations
    for (POIXMLDocumentPart p : getSlideShow().getRelations()) {
      if (p instanceof XSLFCommentAuthors) {
        _commentAuthors = (XSLFCommentAuthors)p;
        return _commentAuthors;
      }
    }
  }
  return null;
}

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

/**
   * Gets the requested text from the slide
   *
   * @param slide       the slide to retrieve the text from
   * @param slideText   Should we retrieve text from slides?
   * @param notesText   Should we retrieve text from notes?
   * @param commentText Should we retrieve text from comments?
   * @param masterText  Should we retrieve text from master slides?
   * @return the extracted text
   */
  public static String getText(XSLFSlide slide, boolean slideText, boolean notesText, boolean commentText, boolean masterText) {
    final SlideShowExtractor<XSLFShape, XSLFTextParagraph> ex = new SlideShowExtractor<>(slide.getSlideShow());
    ex.setSlidesByDefault(slideText);
    ex.setNotesByDefault(notesText);
    ex.setCommentsByDefault(commentText);
    ex.setMasterByDefault(masterText);
    return ex.getText(slide);
  }
}

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

private void copyChart(CTGraphicalObjectData objData, XSLFGraphicFrame srcShape) {
  XSLFSlide slide = (XSLFSlide) getSheet();
  XSLFSheet src = srcShape.getSheet();
  String xpath = "declare namespace c='http://schemas.openxmlformats.org/drawingml/2006/chart' c:chart";
  XmlObject[] obj = objData.selectPath(xpath);
  if (obj != null && obj.length == 1) {
    XmlCursor c = obj[0].newCursor();
    try {
      // duplicate chart with embedded workbook
      QName idQualifiedName = new QName("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "id");
      String id = c.getAttributeText(idQualifiedName);
      XSLFChart srcChart = (XSLFChart) src.getRelationById(id);
      XSLFChart chartCopy = slide.getSlideShow().createChart(slide);
      chartCopy.importContent(srcChart);
      chartCopy.setWorkbook(srcChart.getWorkbook());
      c.setAttributeText(idQualifiedName, slide.getRelationId(chartCopy));
    } catch (InvalidFormatException e) {
      throw new POIXMLException(e);
    } catch (IOException e) {
      throw new POIXMLException(e);
    }
    c.dispose();
  }
}

相关文章