List of usage examples for org.apache.poi.xslf.usermodel XSLFSlide getTitle
@Override
public String getTitle()
From source file:com.github.codeurjc.slidesconverter.PowerPointToHTML.java
License:Apache License
private String calculateTitle(XSLFSlide slideX, HSLFSlide slide) { String title = slide.getTitle(); if (title != null) { return title; }//from w w w .j a v a 2 s. c o m title = slideX.getTitle(); if (title != null) { return title; } boolean titleSlide = ArrayUtils.contains(titleSlides, slideX.getSlideNumber()); for (XSLFShape shape : slideX.getShapes()) { if (shape instanceof XSLFTextShape) { XSLFTextShape tsh = (XSLFTextShape) shape; Rectangle2D figure = getRelativeFigure(tsh); if (titleSlide || figure.getY() < 0.1) { StringBuilder titleSB = new StringBuilder(); for (XSLFTextParagraph p : tsh) { for (XSLFTextRun r : p) { titleSB.append(r.getRawText()); } } title = titleSB.toString(); if (!title.trim().isEmpty()) { return title; } } } } return null; }
From source file:poi.xslf.usermodel.tutorial.Step1.java
License:Apache License
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("Input file is required"); return;/*from www.j a v a2s . c o m*/ } XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(args[0])); for (XSLFSlide slide : ppt.getSlides()) { System.out.println("Title: " + slide.getTitle()); for (XSLFShape shape : slide.getShapes()) { if (shape instanceof XSLFTextShape) { XSLFTextShape tsh = (XSLFTextShape) shape; for (XSLFTextParagraph p : tsh) { System.out.println("Paragraph level: " + p.getLevel()); for (XSLFTextRun r : p) { System.out.println(r.getText()); System.out.println(" bold: " + r.isBold()); System.out.println(" italic: " + r.isItalic()); System.out.println(" underline: " + r.isUnderline()); System.out.println(" font.family: " + r.getFontFamily()); System.out.println(" font.size: " + r.getFontSize()); System.out.println(" font.color: " + r.getFontColor()); } } } } } }