If i change rowSumsBelow in false value, then in Excel for outline we have the same result as true value. And i found, that if i will change attribute alternativeExpression, then it will change view of outline(It seems for me, that you mix up this attributes)
Seems to me that 'field_1_wsbool' and 'field_2_wsbool' are mixed. After replacement worked fine with me WSBoolRecord::setRowSumsBelow public void setRowSumsBelow(boolean below) { field_2_wsbool = rowsumsbelow.setByteBoolean(field_2_wsbool, below); }
Indeed, the bytes in WSBoolRecord seem to have been mixed. My workaround for this problem was to set the same bit in the other byte. Explaining, what I wanted was to setRowSumsBelow to false. Well, rowSumsBelow corresponds (in the source code <a href="http://svn.apache.org/viewvc/jakarta/poi/tags/REL_2_5_1/src/java/org/apache/poi/hssf/record/WSBoolRecord.java?revision=353578&view=markup">here</a> ) to bit 0x40 of byte 1, but it doesn't work. However, if we set bit 0x40 of byte 2 to false (which happens to be setAlternateExpression(false)) then we get rowSumsBelow working correctly. Coming to a conclusion, if you want to setRowSumsBelow to false, set instead alternateExpression and you will get what you are looking for.
This bug still exists even in HEAD version. Will this fix it? --- WSBoolRecord.java (revision 563431) +++ WSBoolRecord.java (working copy) @@ -93,9 +93,9 @@ { byte data[] = in.readRemainder(); field_1_wsbool = - data[ 1 ]; // backwards because theoretically this is one short field + data[ 0 ]; // backwards because theoretically this is one short field field_2_wsbool = - data[ 0 ]; // but it was easier to implement it this way to avoid confusion + data[ 1 ]; // but it was easier to implement it this way to avoid confusion } // because the dev kit shows the masks for it as 2 byte fields // why? Why ask why? But don't drink bud dry as its a really @@ -352,8 +352,8 @@ { LittleEndian.putShort(data, 0 + offset, sid); LittleEndian.putShort(data, 2 + offset, ( short ) 0x2); - data[ 5 + offset ] = getWSBool1(); - data[ 4 + offset ] = getWSBool2(); + data[ 4 + offset ] = getWSBool1(); + data[ 5 + offset ] = getWSBool2(); return getRecordSize(); }
Any chance you could upload some sort of unit test for this? Possibly two files, identical except for the flag being set differently, and a little unit test that detects the flag properly on the two, and can set the flag to get from one to the other. That way, when the patch is applied, we can be sure it's properly fixed, and won't get broken again in the future.
Fixed in r766273 Yegor *** This bug has been marked as a duplicate of bug 46174 ***