Bug 53434

Summary: Subtotal is not return correct value.
Product: POI Reporter: Shunji Konishi <shun.konishi>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.8-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Test of Subtotal function

Description Shunji Konishi 2012-06-19 09:57:07 UTC
I think, 
because LazyAreaEval#isSubtotal is not considered to relative index.

I corrected LazyAreaEval.java in my local environment, is as follows.

--- return _evaluator.isSubTotal(rowIndex, columnIndex);
+++ return _evaluator.isSubTotal(getFirstRow() + rowIndex, getFirstColumn() + columnIndex);

After that, it seems to work correctly.

Please check.

Regards.
Comment 1 Yegor Kozlov 2012-06-19 10:43:27 UTC
Can you please upload a unit test that demonstrates what is wrong and proves that you patch fixes it ? 

Yegor
Comment 2 Shunji Konishi 2012-06-20 05:23:02 UTC
Created attachment 28964 [details]
Test of Subtotal function

Hi,
I modified TestSubtotal.java, and attached it.

Diff please.

Unfortunately, All of original subtotal tests are start with "A1" cell.
The offset of "A1" is (0, 0).
Therefore, the offset did not affect the results.

My changes are simple.
I modified all of start cell to "B2".

As a result, original source failed test, and my change succeed.

regards.
Comment 3 Yegor Kozlov 2012-06-20 07:10:01 UTC
Thanks. Something to work for me in the POI-3.9 dev cycle.

Regards,
Yegor

(In reply to comment #2)
> Created attachment 28964 [details]
> Test of Subtotal function
> 
> Hi,
> I modified TestSubtotal.java, and attached it.
> 
> Diff please.
> 
> Unfortunately, All of original subtotal tests are start with "A1" cell.
> The offset of "A1" is (0, 0).
> Therefore, the offset did not affect the results.
> 
> My changes are simple.
> I modified all of start cell to "B2".
> 
> As a result, original source failed test, and my change succeed.
> 
> regards.
Comment 4 Evgeniy Berlog 2012-08-28 08:52:46 UTC
Hi, thanks for your patch.
This problem should be fixed in trunk.

Please try with a nightly build - see download links on http://poi.apache.org/
or build yourself from SVN trunk, see http://poi.apache.org/subversion.html