Example usage for org.apache.poi.xslf.usermodel XMLSlideShow getSlides

List of usage examples for org.apache.poi.xslf.usermodel XMLSlideShow getSlides

Introduction

In this page you can find the example usage for org.apache.poi.xslf.usermodel XMLSlideShow getSlides.

Prototype

@Override
public List<XSLFSlide> getSlides() 

Source Link

Document

Return all the slides in the slideshow

Usage

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testMapWithoutTitle() throws TemplateLoadException, IOException {
    final MapData map = createMapData();

    final XMLSlideShow pptx = pptxService.map(map, null);
    testWrite(pptx);/* w w w .j  av  a 2s  . c o m*/

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testReport() throws TemplateLoadException, IOException {
    final DategraphData dategraph = createTwoAxisDategraphData();

    final SunburstData sunburst = createSunburstData();

    final SunburstData bottomRightSunburst = createAlternativeSunburstData();

    final String titleFont = "Times New Roman";
    final double titleFontSize = 12;
    final double titleMargin = 5;
    final double widgetMargins = 3;
    final ReportData report = new ReportData(new ReportData.Child[] {
            new ReportData.Child(0, 0, 0.5, 1, "Left Dategraph", widgetMargins, titleMargin, titleFontSize,
                    titleFont, dategraph),
            new ReportData.Child(0.5, 0, 0.5, 0.5, "Top Right Sunburst", widgetMargins, titleMargin,
                    titleFontSize, titleFont, sunburst),
            new ReportData.Child(0.5, 0.5, 0.5, 0.5, "Bottom Right Sunburst", widgetMargins, titleMargin,
                    titleFontSize, titleFont, bottomRightSunburst), });

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);/*from   w  w  w .  ja  va 2 s  .c  o m*/

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testLinearReport() throws TemplateLoadException, IOException {
    final DategraphData dategraph = createTwoAxisDategraphData();

    final SunburstData sunburst = createSunburstData();

    final SunburstData bottomRightSunburst = createAlternativeSunburstData();

    final String titleFont = "Times New Roman";
    final double titleFontSize = 12;
    final double titleMargin = 5;
    final double widgetMargins = 3;
    final ReportData report = new ReportData(new ReportData.Child[] {
            new ReportData.Child(0, 0, 1, 1, "Slide#1 Dategraph", widgetMargins, titleMargin, titleFontSize,
                    titleFont, dategraph),
            new ReportData.Child(0, 0, 1, 1, "Slide#2 Sunburst", widgetMargins, titleMargin, titleFontSize,
                    titleFont, sunburst),
            new ReportData.Child(0, 0, 1, 1, "Slide#3 Sunburst", widgetMargins, titleMargin, titleFontSize,
                    titleFont, bottomRightSunburst), });

    final XMLSlideShow pptx = pptxService.report(report, true);
    testWrite(pptx);//from w  w w .  j a va  2 s.c  o m

    Assert.assertEquals(pptx.getSlides().size(), 3);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testComplicatedReport() throws TemplateLoadException, IOException {
    final ReportData report = createComplicatedReport(3);

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);/*from   w  w  w.  j a va2  s.c om*/

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testComplicatedReportWithoutWidgetMargins() throws TemplateLoadException, IOException {
    final ReportData report = createComplicatedReport(0);

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);//from w  w w .j a va2  s. co  m

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testComplicatedReportWithoutTextOrMargins() throws TemplateLoadException, IOException {
    final ReportData report = createComplicatedReport(0);

    for (ReportData.Child child : report.getChildren()) {
        child.setTitle(null);/*from w  w  w.  j  av  a  2 s .com*/
    }

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testReportByDeserialization() throws TemplateLoadException, IOException {
    final ReportData report = new ObjectMapper()
            .readValue(PowerPointServiceImplTest.class.getResource("report.json"), ReportData.class);

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);/* w w w  .jav a  2s.com*/

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testMutipleTopicMapReportByDeserialization() throws TemplateLoadException, IOException {
    // This test checks that multiple topicmaps work (tricky since each would apply its own animations)
    final ReportData report = new ObjectMapper().readValue(
            PowerPointServiceImplTest.class.getResource("reportMultiTopicmap.json"), ReportData.class);

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);/*w  w w .ja v a 2 s.  co  m*/

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.hp.autonomy.frontend.reports.powerpoint.PowerPointServiceImplTest.java

License:MIT License

@Test
public void testMixedWidgetReportByDeserialization() throws TemplateLoadException, IOException {
    final ReportData report = new ObjectMapper()
            .readValue(PowerPointServiceImplTest.class.getResource("multiwidgetreport.json"), ReportData.class);

    final XMLSlideShow pptx = pptxService.report(report, false);
    testWrite(pptx);//from   w  w  w. j  ava  2s  .  c o  m

    Assert.assertEquals(pptx.getSlides().size(), 1);
}

From source file:com.linksinnovation.elearning.utils.ppt2pdf.Ppt2Pdf.java

public static void convert(FileInputStream inputStream, FileOutputStream out)
        throws IOException, DocumentException {
    XMLSlideShow ppt = new XMLSlideShow(inputStream);
    inputStream.close();/*from  w  w w. ja  v a 2  s . com*/
    Dimension pgsize = ppt.getPageSize();

    Document document = new Document();
    PdfWriter pdfWriter = PdfWriter.getInstance(document, out);
    document.setPageSize(new Rectangle((float) pgsize.getWidth(), (float) pgsize.getHeight()));
    document.open();
    for (XSLFSlide slide : ppt.getSlides()) {
        System.out.println(pgsize.getWidth() + " " + pgsize.getHeight());
        PdfGraphics2D graphics = (PdfGraphics2D) pdfWriter.getDirectContent()
                .createGraphics((float) pgsize.getWidth(), (float) pgsize.getHeight());
        slide.draw(graphics);
        graphics.dispose();
        document.newPage();
    }
    document.close();
}