On 2013-06-27 Nick Burch wrote: > On Wed, 26 Jun 2013, honyk wrote: > > I'd like to help with implementing the functionality for adding slide > > notes to the presentation... please throw me a rope... thanks. > > First step is to work out what XML is needed, and where. Try to get the > very minimal amount that'll work. What XML do you need? Does it need to > be > in existing parts, or new parts? What relationships exist between the > parts? > > Creating several test files, unzipping them, and running diff against > the > xml (likely having run "xmllint -format" first to get pretty spacing) > is > the order of the day here. Oh, and check the list archives too for > pointer > from people who have already tried some of this > > Then, with that done, try writing code to setup the new parts, > injecting > in preset xml, and modifying the existing xml parts with the raw CT > beans. > Then, create the initial new bits of xml with CT beans. Finally, wrap > it > all up in nice usermodel methods. >
Thanks for your effort. There is a model for slide notes available: http://poi.apache.org/apidocs/org/apache/poi/xslf/usermodel/XSLFNotes.html I can read slide notes from the existing presentation, so I know how the final XML fragment should look like: XMLSlideShow pptx = new XMLSlideShow(new FileInputStream("D:/test.pptx")); for (XSLFSlide slide : pptx.getSlides()) { System.out.println(slide.getNotes().getXmlObject().xmlText()); } This I've already written in my original post. But I am repeating myself again :-) How can inject this or slightly modified XML data back to the presentation? Unfortunately XSLFNotes class has no constructor that would accept CTNotesSlide as a parameter. And it is final and cannot be extended. I suppose this new constructor could be as simple as this: XSLFNotes(CTNotesSlide notes) { super(); _notes = notes; } Now I have to: 1) somehow convert my raw XML data into CTNotesSlide object 2) somehow inject XSLFNotes object into the XSLFSlide My use case is relatively simple. I have slides without any notes. I just want to add several new notes into specific slides. So no modifications or deleting, just adding new ones. Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
