当前位置: 首页>>代码示例>>Java>>正文


Java XMLSlideShow.getSlides方法代码示例

本文整理汇总了Java中org.apache.poi.xslf.usermodel.XMLSlideShow.getSlides方法的典型用法代码示例。如果您正苦于以下问题:Java XMLSlideShow.getSlides方法的具体用法?Java XMLSlideShow.getSlides怎么用?Java XMLSlideShow.getSlides使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.xslf.usermodel.XMLSlideShow的用法示例。


在下文中一共展示了XMLSlideShow.getSlides方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractContent

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
private void extractContent(final StringBuilder buffy, final XMLSlideShow xmlSlideShow) throws IOException, XmlException {
    final XSLFSlide[] slides = xmlSlideShow.getSlides();
    for (final XSLFSlide slide : slides) {
        final CTSlide rawSlide = slide._getCTSlide();
        final CTSlideIdListEntry slideId = slide._getCTSlideId();

        final CTNotesSlide notes = xmlSlideShow._getXSLFSlideShow().getNotes(slideId);
        final CTCommentList comments = xmlSlideShow._getXSLFSlideShow().getSlideComments(slideId);

        extractShapeContent(buffy, rawSlide.getCSld().getSpTree());

        if (comments != null) {
            for (final CTComment comment : comments.getCmArray()) {
                buffy.append(comment.getText()).append(' ');
            }
        }

        if (notes != null) {
            extractShapeContent(buffy, notes.getCSld().getSpTree());
        }
    }
}
 
开发者ID:huihoo,项目名称:olat,代码行数:23,代码来源:PowerPointOOXMLDocument.java

示例2: main

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception
{
	String dataPath = "src/featurescomparison/workingwithslides/moveslide/data/";
	
	XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(dataPath + "presentation.pptx"));

	//add slides
    ppt.createSlide();
    ppt.createSlide();
    ppt.createSlide();

    XSLFSlide[] slides = ppt.getSlides();
    ppt.setSlideOrder(slides[0], 4); 
    
    //save changes in a file
    FileOutputStream out = new FileOutputStream(dataPath + "Apache_ReOrdered_Slides_Out.pptx");
    ppt.write(out);
    out.close();
    
	System.out.println("Slides ReOrdered Successfuly.");
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:22,代码来源:ApacheMoveSlides.java

示例3: actionPerformed

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    SlidesTopComponent currentTopComponent = OfficeTopComponent.getSelectedComponent(SlidesTopComponent.class);
    if (currentTopComponent != null) {
        XMLSlideShow presentation = currentTopComponent.getPresentation();
        int slideIndex = currentTopComponent.getSelectedSlide();
        presentation.removeSlide(slideIndex);
        removeSlideFromPanel(slideIndex, (JPanel) currentTopComponent.getMainComponent());
        currentTopComponent.getDataObject().setModified(true);
        if (slideIndex >= presentation.getSlides().length) {
            currentTopComponent.setSelectedSlide(slideIndex - 1);
        } else {
            currentTopComponent.setSelectedSlide(slideIndex);
        }
    }
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:17,代码来源:RemoveSlideAction.java

示例4: main

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    if (args.length == 0) {
        System.err.println("Please profile a file path to open");
        System.exit(-1);
    }

    JPanel mainPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
    XMLSlideShow presentation = new XMLSlideShow(new FileInputStream(args[0]));
    XSLFSlide[] slides = presentation.getSlides();
    for (XSLFSlide slide : slides) {
        XSLFShape[] shapes = slide.getShapes();
        for (XSLFShape shape : shapes) {

            BufferedImage img = new BufferedImage((int) shape.getAnchor().getWidth(), (int) shape.getAnchor().getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
            Graphics2D graphics = img.createGraphics();
            graphics.translate(-shape.getAnchor().getX(), -shape.getAnchor().getY());
            shape.draw(graphics);
            graphics.dispose();
            JLabel shapeLabel = new JLabel(new ImageIcon(img));
            shapeLabel.setBorder(BorderFactory.createLineBorder(Color.RED));

            mainPanel.add(shapeLabel);
        }
    }
    showDemo(new JScrollPane(mainPanel), "Shape not displayed");
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:27,代码来源:PptxShapeNotDrawn.java

示例5: processSlides

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
protected Dimension processSlides() throws IOException{
	InputStream iStream = inStream;
	XMLSlideShow ppt = new XMLSlideShow(iStream);
	Dimension dimension = ppt.getPageSize();
	slides = ppt.getSlides();
	return dimension;
}
 
开发者ID:yeokm1,项目名称:docs-to-pdf-converter,代码行数:8,代码来源:PptxToPDFConverter.java

示例6: actionPerformed

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    SlidesTopComponent currentTopComponent = OfficeTopComponent.getSelectedComponent(SlidesTopComponent.class);
    if (currentTopComponent != null) {
        XMLSlideShow currentPresentation = currentTopComponent.getPresentation();
        int selectedSlide = currentTopComponent.getSelectedSlide();
        XSLFSlide slide = currentPresentation.getSlides()[selectedSlide];
        // not possible to change the layout in Apache POI
    }
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:11,代码来源:ChooseLayoutAction.java

示例7: loadSlides

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
@Override
protected void loadSlides(InputStream stream) throws IOException {
    XMLSlideShow ppt = new XMLSlideShow(stream);
    dimension = ppt.getPageSize();
    slides = ppt.getSlides();
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:7,代码来源:PptxToPdfConverter.java

示例8: buildXHTML

import org.apache.poi.xslf.usermodel.XMLSlideShow; //导入方法依赖的package包/类
/**
 * @see org.apache.poi.xslf.extractor.XSLFPowerPointExtractor#getText()
 */
protected void buildXHTML(XHTMLContentHandler xhtml) throws SAXException,
    IOException {
  XMLSlideShow slideShow = (XMLSlideShow) extractor.getDocument();

  XSLFSlide[] slides = slideShow.getSlides();
  for (XSLFSlide slide : slides) {
    String slideDesc;

    if (slide.getPackagePart() != null
        && slide.getPackagePart().getPartName() != null) {
      slideDesc = getJustFileName(slide.getPackagePart().getPartName()
          .toString());
      slideDesc += "_";
    } else {
      slideDesc = null;
    }

    // slide
    extractContent(slide.getShapes(), false, xhtml, slideDesc);

    // slide layout which is the master sheet for this slide
    XSLFSheet slideLayout = slide.getMasterSheet();
    extractContent(slideLayout.getShapes(), true, xhtml, null);

    // slide master which is the master sheet for all text layouts
    XSLFSheet slideMaster = slideLayout.getMasterSheet();
    extractContent(slideMaster.getShapes(), true, xhtml, null);

    // notes (if present)
    XSLFSheet slideNotes = slide.getNotes();
    if (slideNotes != null) {
      extractContent(slideNotes.getShapes(), false, xhtml, slideDesc);
      // master sheet for this notes
      XSLFSheet notesMaster = slideNotes.getMasterSheet();
      extractContent(notesMaster.getShapes(), true, xhtml, null);
    }

    // comments (if present)
    XSLFComments comments = slide.getComments();
    if (comments != null) {
      for (CTComment comment : comments.getCTCommentsList().getCmList()) {
        xhtml.element("p", comment.getText());
      }
    }
  }

  if (Config.inst().getProp(ConfigBool.ENABLE_IMAGE_OCR)) {
    TikaImageHelper helper = new TikaImageHelper(metadata);
    try {
      List<XSLFPictureData> pictures = slideShow.getAllPictures();
      for (XSLFPictureData picture : pictures) {
        ByteArrayInputStream imageData = new ByteArrayInputStream(
            picture.getData());
        BufferedImage image = ImageIO.read(imageData);
        helper.addImage(image);
        helper.addTextToHandler(xhtml);
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (extractor != null) {
        extractor.close();
      }
      if (helper != null) {
        helper.close();
      }
    }
  }
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:73,代码来源:XSLFPowerPointExtractorDecorator.java


注:本文中的org.apache.poi.xslf.usermodel.XMLSlideShow.getSlides方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。