Re: PPTX getting the custome marked list with special icons.
Hi Savotii, I've made some changes to the codebase [1] - the placeholder code in XSLFShape.getPlaceholder() based on the placeholder type instead of the index is not valid for all cases ... Please use a nightly [2] tomorrow, when the changes are compiled into. You can then use the following code: public class TestLayoutImages { static List> PARA_PROPS = Arrays.asList( XDDFTextBody::getDefaultProperties, XDDFTextBody::getLevel1Properties, XDDFTextBody::getLevel2Properties, XDDFTextBody::getLevel3Properties, XDDFTextBody::getLevel4Properties, XDDFTextBody::getLevel5Properties, XDDFTextBody::getLevel6Properties, XDDFTextBody::getLevel7Properties, XDDFTextBody::getLevel8Properties, XDDFTextBody::getLevel9Properties ); @Test public void exportImages() throws IOException { try (FileInputStream fis = new FileInputStream("example.pptx"); XMLSlideShow ppt = new XMLSlideShow(fis)) { XSLFSlide slide = ppt.getSlides().get(0); XSLFTextShape list = (XSLFTextShape)slide.getShapes().get(0); XSLFAutoShape shape = (XSLFAutoShape)list.getPlaceholderDetails().getPlaceholderShape(); XDDFTextBody phBody = shape.getTextBody(); int indent = list.getTextParagraphs().get(0).getIndentLevel(); XDDFParagraphProperties props = PARA_PROPS.get(indent == 0 || indent > 9 ? 1 : indent).apply(phBody); String bulletId = props.getBulletProperties().getXmlObject().getBuBlip().getBlip().getEmbed(); POIXMLDocumentPart rel = slide.getMasterSheet().getRelationById(bulletId); PackagePart pp = rel.getPackagePart(); try (InputStream is = pp.getInputStream(); FileOutputStream fos = new FileOutputStream(new File(pp.getPartName().getName()).getName())) { IOUtils.copy(is, fos); } } } } Best wishes, Andi [1] https://svn.apache.org/viewvc?view=revision=1875328 [2] https://builds.apache.org/view/P/view/POI/job/POI-DSL-1.8/lastSuccessfulBuild/artifact/build/dist/ signature.asc Description: OpenPGP digital signature
Re: PPTX getting the custome marked list with special icons.
Maybe you could indicate on low level code, where can I find some solution for my reason? Thx a lot. -- Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
Re: PPTX getting the custome marked list with special icons.
Hi, It seems the bullet style is defined at the master level, not directly at the paragraph level, in your particular case. Unfortunately, I did not have time to finish the high level API which was intended to perform the search for these paragraph properties. When trying to use the following code on your paragraph, some null reference will be returned too: String bulletId = shape.getTextBody().getParagraph(0).getBulletProperties().getPicture().getXmlObject().getEmbed(); Cheers, Alain FAGOT BÉAREZ Je 2020-03-04 09:55, savotii skribis: Unfortunately, your example doesn't work for me. para.getPPr().getBuBlip() returns a null. - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
Re: PPTX getting the custome marked list with special icons.
Unfortunately, your example doesn't work for me. para.getPPr().getBuBlip() returns a null. -- Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
Re: PPTX getting the custome marked list with special icons.
Thx a lot, Yes It's my mistake about absent example, I'm here the new desperate member) I'll try your example and answer, if it's ok. I've attached my example. I'm interested in extracted an icon near by text. Quite complicated for me. Anyway, thx for your example. -- Sent from: http://apache-poi.1045710.n5.nabble.com/POI-Dev-f2312866.html - To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org
Re: PPTX getting the custome marked list with special icons.
Hi, > how can I retrieve the predefined custom marked list with some special icon As you haven't provided any example file, I've made one up myself. So I have a bullet list with custom images. Accessing the images can be done like this: try (FileInputStream fis = new FileInputStream("CustomBulletList.pptx"); XMLSlideShow ppt = new XMLSlideShow(fis)) { XSLFSlide slide = ppt.getSlides().get(0); XSLFAutoShape shape = (XSLFAutoShape) slide.getShapes().get(1); CTTextParagraph para = shape.getTextParagraphs().get(0).getXmlObject(); String bulletId = para.getPPr().getBuBlip().getBlip().getEmbed(); POIXMLDocumentPart rel = slide.getRelationById(bulletId); PackagePart pp = rel.getPackagePart(); try (InputStream is = pp.getInputStream(); FileOutputStream fos = new FileOutputStream(new File(pp.getPartName().getName()).getName())) { IOUtils.copy(is, fos); } } Not sure if this helps you, but if not, you need to put more effort into your question, e.g. a sample file and what you expect from reading that file. Andi CustomBulletList.pptx Description: MS-Powerpoint 2007 presentation signature.asc Description: OpenPGP digital signature