Bug 46186

Summary: method groupRow does not work
Product: POI Reporter: Dmitry Smirnov <dsmirnov>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: regression CC: ralf.tossenberger
Priority: P2    
Version: 3.2-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: excel file

Description Dmitry Smirnov 2008-11-11 06:47:20 UTC
Created attachment 22855 [details]
excel file

reroducing step:
1. I'm created src.xls file in Excel and after that 
2. I'm create HSSFWorkbook on the basis of existing excel file
3. group some row
4. I'm open new dst.xls and group row id absent. 

This is bug. src.xls in attach


simple code:
public class Test {

    public static void main(String[] args) throws Exception {

       HSSFWorkbook(StreamUtil.getInputStream("c:\\src.xls"));
       HSSFSheet sheet = wb.getSheetAt(0);
       sheet.groupRow(5,10); // <-- look here
       final FileOutputStream out = new FileOutputStream(new File("C:\\dst.xls"));
       try {
            wb.write(out);
        } finally {
            out.close();
        }
    }
}
Comment 1 Yegor Kozlov 2008-11-11 08:19:36 UTC
Did it work with earlier versions of POI? I checked your code with 3.0.2 and it doesn't work either. It seems to be not a regression, something is special with your src.xls. 

How was this file created? Using POI or manually in Excel? Which version?

groupRow() works fine when creating new sheets but somehow doesn't work for the attached file.

Yegor
Comment 2 Dmitry Smirnov 2008-11-11 08:32:22 UTC
this is excel file was created in 2003 excel sp3 and save as microsoft excel 97...
Im tested it on poi 3.2 version.
For  poi version 3.0.1 groupRow working fine.

sorry for bad test, this is better
 public static void main(String[] args) throws Exception {
        HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("c:\\src.xls"));
        HSSFSheet sheet = wb.getSheetAt(0);
        sheet.groupRow(5, 10); // <-- look here
        final FileOutputStream out = new FileOutputStream(new File("C:\\dst.xls"));
        try {
            wb.write(out);
        } finally {
            out.close();
        }
    }


Comment 3 Ralf Tossenberger 2008-12-20 07:42:21 UTC
Same problem with 3.5 Beta 4, using Office 2003 (Windows) or Office 2007/8 (Mac)

If Workbook / Sheet was created new --> works
If Workbook / Sheet was loaded from file --> doesn't work

I tried the attached src.xls, tried a new one - fresh created with same data, tried an empty one - created inside Windows explorer with create new Excel.

Comment 4 Bob Stox 2009-03-13 12:05:20 UTC
The Problem was that in 3.2 a new variable was added to the Sheet class _gutsRecord but it was never initialized when in the Sheet(RecordStream rs) constructor.  I just added the code to check for the GutsRecord.sid and the assign the record to the variable
Comment 5 Yegor Kozlov 2009-04-18 02:09:38 UTC
Fixed in r766273

Regards,
Yegor