Bug 57459

Summary: [PATCH] Add method to directly set row OutLineLevel
Product: POI Reporter: Justin Schoeman <justin>
Component: SXSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal Keywords: PatchAvailable
Priority: P2    
Version: 3.11-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: add setRowOutlineLevel method
Crude test case for consideration

Description Justin Schoeman 2015-01-19 08:20:38 UTC
Created attachment 32377 [details]
add setRowOutlineLevel method

Currently, SXSSFSheet.groupRow is the only way to create a row group.  Unfortunately, it requires that all the rows for the entire group to be in the row access window.  This is not possible in my case (insufficient memory to keep that many rows in memory).

This is a simple API addition to allow programmers to directly set the row outline level, as the rows are created.

Since I do not really know Java, this is very simple code - mostly copy-and-paste from related parts of the same file.

Thanks,
Justin
Comment 1 Dominik Stadler 2015-02-11 21:33:28 UTC
Thanks for the submission, any chance of a unit-test to go along so the feature stays in-place unbroken by future changes?
Comment 2 Justin Schoeman 2015-02-12 10:24:57 UTC
(In reply to Dominik Stadler from comment #1)
> Thanks for the submission, any chance of a unit-test to go along so the
> feature stays in-place unbroken by future changes?

Can you perhaps find any hints?  I can't even find any existing SXSSF test cases to work from...
Comment 3 Dominik Stadler 2015-02-13 20:50:39 UTC
I would probably start from the ones in TestSXSSFSheet (http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java?view=markup), e.g. overrideRowsInTemplate(). 

Then build a unit test with the following:
* Create a document using SXSSF, 
* write it into a temporary file
* read it back in using XSSF and 
* verify that the outline grouping is set correctly
Comment 4 Justin Schoeman 2015-02-14 08:55:31 UTC
Created attachment 32473 [details]
Crude test case for consideration

This was done before Dominik Stadler's suggestion.  It basically extends the existing TestOutlining.java to include this method.  Not sure if this is acceptable, or if this should be a completely separate test.
Comment 5 Dominik Stadler 2015-02-14 13:43:51 UTC
This is applied via r1659785, I slightly reworked the tests to separate them a bit more into the different types of workbook. Thanks for the patch!
Comment 6 Justin Schoeman 2015-02-16 09:45:58 UTC
(In reply to Dominik Stadler from comment #5)
> This is applied via r1659785, I slightly reworked the tests to separate them
> a bit more into the different types of workbook. Thanks for the patch!

Thank you very much for accepting the patch, and all the cleanups.  It will be really helpful to have this functionality available in production releases.