I am using poi-3.0.1-FINAL-20070705. To get around the inability to create tables, I tried pre-creating a table in PowerPoint and importing and editing the cells with HSLF, but ran into a problem. I tried looping through all the TextBoxes and writing into them, and it turned out that if I wrote into more than 22 TextBoxes, I would get this message when I tried to open the PPT file: "PowerPoint was unable to display some of the text, images, or objects on slides in the file, filename.ppt, because they have become corrupted. Effected slides have been replaced by blank slides…" When the PPT opens, I just get a blank slide. If I only write into 22 TextBoxes or less, it works fine. No Exceptions are being thrown or anything, there is only a problem when I open the PPT file. Also, it seems to be only possible to edit a TextBox if it has text in it already. So I created my Table with a single zero (0) in each cell. Here is a code snippet of what I am doing: //aShapeGroup is a table created in PowerPoint with 52 cells, 13x4 org.apache.poi.hslf.model.Shape[] shg = aShapeGroup.getShapes(); //replace shg.length with 22 and 23 to test. 22 or less will work, 23 or greater will not. for(int i=0; i < shg.length; i++) { if (shg[i].getClass().getName().equals("org.apache.poi.hslf.model.TextBox")) { //all this does it write the index into the TextBox tb.setText(String.valueOf(i)); } }
Created attachment 21237 [details] PPT imported for editing Imported like this: SlideShow ppt = new SlideShow(new HSLFSlideShow("tableTemplate.ppt"));
The release notes for 3.0.2-BETA2 which is being voted on now indicate that support for Tables has been added to HSLF. It can be downloaded from: http://people.apache.org/~yegor/POI-3.0.2-BETA2/ This code should be pretty stable since Yegor developed a private version of this for us and that is very stable.
As per David's comment, please could you indicate if your problem is fixed with 3.0.2 beta 2?
The problem has not been fixed with poi-bin-3.0.2-beta2-20080112. The problem is still exactly the same.
I am setting this very old discussion to WORKSFORME for now, there have been a huge number of changes since release 3.0.x, please try with the latest version of POI and if it still does not work please reopen this bug with a self-contained piece of code (ideally as unit-test) that reproduces this with the provided sample file.