On Thu, 30 Jan 2014, zzzimon wrote:
Hi, I need to modify the /ppt/presentation.xml part but when I do that using
the part.getOutputStream method nothing happens. Here is my code:

        public static void main(final String[] args) throws Exception {
                final XMLSlideShow ppt = new XMLSlideShow();

This creates a new in-memory /ppt/presentation.xml

                final PackagePart part = ppt.getPackage().getPart(
                                
PackagingURIHelper.createPartName("/ppt/presentation.xml"));
                final String content = "<HelloWorld />";
                final OutputStream os = part.getOutputStream();
                final PrintStream printStream = new PrintStream(os);
                printStream.print(content);
                printStream.close();

This updates the copy in the part, but...

                // print slide show to pptx file
                final FileOutputStream out = new 
FileOutputStream("C:/simon/test.pptx");

                ppt.write(out);

This then overwrites the /ppt/presentation.xml in the package with the one from the XMLSlideShow

You either need to work with the XMLSlideShow itself to edit the file, or only open at the OPCPackage level and not XSLF to have full control yourself

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to