Hello,

i have a problem with the setTotalsRowFunction / setCellFormula method starting with poi version 5.2.0 and above. In previous versions including 5.1.0 everything works fine.

Excel complains about a broken worksheet and after repairing the totalsrow is inside the table. I compared the resulting xml files and noticed the following difference:

diff --color -ur works/xl/worksheets/sheet1.xml broken/xl/worksheets/sheet1.xml
--- works/xl/worksheets/sheet1.xml      2023-06-20 11:31:01.313017689 +0200
+++ broken/xl/worksheets/sheet1.xml     2023-06-20 11:30:57.709657562 +0200
@@ -81,10 +81,10 @@
         <v>4</v>
       </c>
       <c r="B6">
-        <f>SUBTOTAL(109,Table1[Heading2])</f>
+        <f>SUBTOTAL(109,Sheet0!B2:B6)</f>
       </c>
       <c r="C6">
-        <f>SUBTOTAL(109,Table1[Heading3])</f>
+        <f>SUBTOTAL(109,Sheet0!C2:C6)</f>
       </c>
       <c r="D6" t="s">
         <v>4</v>

For some reason poi >= 5.2.0 rewrites the cell formula from table columns to a normal range.


Under [1] i have pushed a simple test case to reproduce the issue - including the resulting xlsx and the extracted and formated xml files. (The test case is copied from this stackoverflow [2] question)

Does someone have an idea how to solve this?

[1] https://github.com/ManiacTwister/poi-table-bisect
[2] https://stackoverflow.com/questions/68783226/apache-poi-set-cell-format-that-include-the-result-of-table-total-row

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to