Search in sources :

Example 1 with XSLFTextRun

use of org.apache.poi.xslf.usermodel.XSLFTextRun in project poi by apache.

the class Step1 method main.

public static void main(String[] args) throws Exception {
    if (args.length == 0) {
        System.out.println("Input file is required");
        return;
    }
    FileInputStream fis = new FileInputStream(args[0]);
    XMLSlideShow ppt = new XMLSlideShow(fis);
    fis.close();
    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.getIndentLevel());
                    for (XSLFTextRun r : p) {
                        System.out.println(r.getRawText());
                        System.out.println("  bold: " + r.isBold());
                        System.out.println("  italic: " + r.isItalic());
                        System.out.println("  underline: " + r.isUnderlined());
                        System.out.println("  font.family: " + r.getFontFamily());
                        System.out.println("  font.size: " + r.getFontSize());
                        System.out.println("  font.color: " + r.getFontColor());
                    }
                }
            }
        }
    }
    ppt.close();
}
Also used : XSLFSlide(org.apache.poi.xslf.usermodel.XSLFSlide) XSLFTextParagraph(org.apache.poi.xslf.usermodel.XSLFTextParagraph) XMLSlideShow(org.apache.poi.xslf.usermodel.XMLSlideShow) XSLFTextShape(org.apache.poi.xslf.usermodel.XSLFTextShape) XSLFShape(org.apache.poi.xslf.usermodel.XSLFShape) FileInputStream(java.io.FileInputStream) XSLFTextRun(org.apache.poi.xslf.usermodel.XSLFTextRun)

Aggregations

FileInputStream (java.io.FileInputStream)1 XMLSlideShow (org.apache.poi.xslf.usermodel.XMLSlideShow)1 XSLFShape (org.apache.poi.xslf.usermodel.XSLFShape)1 XSLFSlide (org.apache.poi.xslf.usermodel.XSLFSlide)1 XSLFTextParagraph (org.apache.poi.xslf.usermodel.XSLFTextParagraph)1 XSLFTextRun (org.apache.poi.xslf.usermodel.XSLFTextRun)1 XSLFTextShape (org.apache.poi.xslf.usermodel.XSLFTextShape)1