Bug 53434 - Subtotal is not return correct value.
Summary: Subtotal is not return correct value.
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.8-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-19 09:57 UTC by Shunji Konishi
Modified: 2012-08-28 08:52 UTC (History)
0 users



Attachments
Test of Subtotal function (7.95 KB, application/x-zip-compressed)
2012-06-20 05:23 UTC, Shunji Konishi
Details

Note You need to log in before you can comment on or make changes to this bug.
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