Reputation: 41
I've been having issues using POI-3.10-FINAL
where editing a PPTX doesn't fully work. I noticed that I am successfully able to add new slides, but modifications to shapes (in this case, a table) aren't reflected in the outputted PPTX file.
I was able to fix it by switching from poi-ooxml-schemas-*.jar
to ooxml-schemas-1.1.jar
but the resulting PPTX file seems to be corrupted: PowerPoint 2007 fails to open it but PowerPoint 2010 repairs it first, then properly opens it.
In investigating the issue, I noticed that the "docProps/app.xml" is not being updated correctly (I'm assuming other files within the PPTX aren't being updated as well).
Any ideas?
Upvotes: 2
Views: 629
Reputation: 41
I've been able to properly troubleshoot and fix my POI issues using Microsoft's OpenXml SDK (see OpenXml SDK). The SDK helps you scan through a PPTX file (or any other OpenXml document) and compiles a list of all errors it finds.
In my case, I was setting one of my table cell's text value to null. In turn, POI generated the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" declaration at the top most slide tag and used xsi:nil="true" within the cell's tag which PowerPoint absolutely did not like.
Another issue I was having was that I was modifying and creating new rows and columns within my table. To make things easier in my code, whenever I did anything to a cell, I made sure I set the border information to black with a width of 1 and the fill color to white. For some odd reason it seems that POI was not replacing the border information, but appending it which made the PPTX have 2 conflicting values rather than 1 (I have to investigate this one further but checking the border and fill information before trying to set them definitely fixed my issue).
These issues were rather easy to fix once I figured them out.
Upvotes: 2