Bug 44030

Summary: Slides corrupted when editing tables
Product: POI Reporter: Steven Luu <sluu123>
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 3.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: PPT imported for editing

Description Steven Luu 2007-12-06 01:19:03 UTC
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));
       }
}
Comment 1 Steven Luu 2007-12-06 01:21:55 UTC
Created attachment 21237 [details]
PPT imported for editing

Imported like this:

SlideShow ppt = new SlideShow(new HSLFSlideShow("tableTemplate.ppt"));
Comment 2 David Fisher 2008-01-08 16:09:38 UTC
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.
Comment 3 Nick Burch 2008-01-09 03:16:18 UTC
As per David's comment, please could you indicate if your problem is fixed with
3.0.2 beta 2?
Comment 4 Steven Luu 2008-01-25 15:48:47 UTC
The problem has not been fixed with poi-bin-3.0.2-beta2-20080112.  The problem
is still exactly the same.
Comment 5 Dominik Stadler 2015-06-29 08:52:24 UTC
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.