xslf

XSLFGroupShape does not encompass its child shapes

故事扮演 提交于 2021-02-17 03:34:33
问题 I'm using Apache POI 3.16 (the latest version at the time of writing). In the following snippet, I create a XSLFGroupShape which I then use to create a bunch of child shapes: XSLFGroupShape group = slide.createGroup(); XSLFAutoShape cardRect = group.createAutoShape(); cardRect.setShapeType(ShapeType.RECT); cardRect.setAnchor(rect); XSLFPictureShape avatarShape = group.createPicture(avatar); // More shapes added to the group here... The problem is the following: in the generated PowerPoint

How to get “last saved by” Office file attribute in Java

我怕爱的太早我们不能终老 提交于 2019-12-12 14:55:43
问题 I am trying to get the "last saved by" attribute from MS Office 2013 file(docx, xlsx, pptx ...). I am using Apache POI, but I can get only the Author of the file with the following code: OPCPackage pkg = OPCPackage.open(file); POIXMLProperties props = new POIXMLProperties(pkg); props.getCoreProperties().getCreator(); Is there a way to get "last saved by" attribute? 回答1: Lookin at the Apache POI OOXML Properties Extractor as a good source of inspiration for this sort of problem, we see what

ERROR : Caused by: java.lang.IllegalArgumentException: Relationship null doesn't start with this part /ppt/slides/slide3.xml

笑着哭i 提交于 2019-12-12 01:26:48
问题 I'm working with apache poi xslf to export ppt file. First, I have a template set with 3 slides : title slide, summary slide, and third slide I duplicate the 3rd slide (i have it as a template) in order to copy many data/graphics as I have in database. So in order to do that : XMLSlideShow slideShow = new XMLSlideShow(dlfile.getContentStream()); XSLFSlide[] slides = slideShow.getSlides(); XSLFSlide createdSlide = slideShow.createSlide(slides[2].getSlideLayout()); //get content from slide to

How to get pptx slide notes text using apache poi?

送分小仙女□ 提交于 2019-12-05 17:02:59
So far I only have a working code for retrieving texts from ppt slide notes try { FileInputStream is = new FileInputStream("C:\\sample\\test.ppt"); SlideShow ppt = new SlideShow(is); Slide[] slide = ppt.getSlides(); for (int i = 0; i < slide.length; i++) { System.out.println(i); TextRun[] runs = slide[i].getNotesSheet().getTextRuns(); if (runs.length < 1) { System.out.println("null"); } else { for (TextRun run : runs) { System.out.println(" > " + run.getText()); } } } } catch (IOException ioe) { } But how do you retrieve text from pptx slide notes? After constant trial and error, found a

Attach 3 images in single slide at specified positions using Apache POI XSLF

我怕爱的太早我们不能终老 提交于 2019-12-02 12:56:18
问题 I need to paste 3 pictures in single slide using Apache POI XSLF. However I could able to add only one picture in a slide. Also I could not find any ways to specify the size and orientation the picture should be. Tried the following code XMLSlideShow ppt = new XMLSlideShow(); XSLFSlide slide = ppt.createSlide(); XSLFGroupShape group1 = slide.createGroup(); byte buf[] = new byte[1024]; for (int i = 1; i <= 2; i++) { byte[] pictureData = IOUtils.toByteArray(new FileInputStream( "C:\\Users\

Attach 3 images in single slide at specified positions using Apache POI XSLF

混江龙づ霸主 提交于 2019-12-02 03:36:01
I need to paste 3 pictures in single slide using Apache POI XSLF. However I could able to add only one picture in a slide. Also I could not find any ways to specify the size and orientation the picture should be. Tried the following code XMLSlideShow ppt = new XMLSlideShow(); XSLFSlide slide = ppt.createSlide(); XSLFGroupShape group1 = slide.createGroup(); byte buf[] = new byte[1024]; for (int i = 1; i <= 2; i++) { byte[] pictureData = IOUtils.toByteArray(new FileInputStream( "C:\\Users\\Ashok\\Pictures\\" + i + ".png")); int elementIndex = ppt.addPicture(pictureData, XSLFPictureData.PICTURE

How to get pptx slide notes text using apache poi?

一世执手 提交于 2019-12-01 05:53:06
问题 So far I only have a working code for retrieving texts from ppt slide notes try { FileInputStream is = new FileInputStream("C:\\sample\\test.ppt"); SlideShow ppt = new SlideShow(is); Slide[] slide = ppt.getSlides(); for (int i = 0; i < slide.length; i++) { System.out.println(i); TextRun[] runs = slide[i].getNotesSheet().getTextRuns(); if (runs.length < 1) { System.out.println("null"); } else { for (TextRun run : runs) { System.out.println(" > " + run.getText()); } } } } catch (IOException ioe

Extracting images from pptx with apache poi

有些话、适合烂在心里 提交于 2019-11-28 14:29:57
I'm trying to extract slides from a ppt file with Apache POI, there is no problem in that, but now I intend to open pptx files and do the same, does anyone knows how to?? this is the code to extract images from ppt files: public ImageIcon display() throws JPresentationException { Background background; background = slides[current].getBackground(); Fill f = background.getFill(); Color color = f.getForegroundColor(); Dimension dimension = ppt.getPageSize(); shapes = slides[current].getShapes(); BufferedImage img = new BufferedImage(dimension.width, dimension.height, BufferedImage.TYPE_INT_RGB);

Extracting images from pptx with apache poi

吃可爱长大的小学妹 提交于 2019-11-27 08:28:48
问题 I'm trying to extract slides from a ppt file with Apache POI, there is no problem in that, but now I intend to open pptx files and do the same, does anyone knows how to?? this is the code to extract images from ppt files: public ImageIcon display() throws JPresentationException { Background background; background = slides[current].getBackground(); Fill f = background.getFill(); Color color = f.getForegroundColor(); Dimension dimension = ppt.getPageSize(); shapes = slides[current].getShapes();