本文整理汇总了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());
}
}
}
示例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.");
}
示例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);
}
}
}
示例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");
}
示例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;
}
示例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
}
}
示例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();
}
示例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();
}
}
}
}