https://issues.apache.org/bugzilla/show_bug.cgi?id=45645

           Summary: autoSizeColumn() works incorrectly for large widths (cf.
                    bug #43090)
           Product: POI
           Version: 3.0-dev
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Preliminary note: This bug is in 3.1-FINAL, but the latest version the Combo
Box did offer was 3.0-dev

In HSSFSheet.autoSizeColumns(), the following code:

if (width != -1) {
    if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE!
        width = Short.MAX_VALUE;
    }
    sheet.setColumnWidth(column, (short) (width * 256));
}

should be replaced by:

if (width != -1) {
    width *= 256;
    if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE!
        width = Short.MAX_VALUE;
    }
    sheet.setColumnWidth(column, (short) (width));
}

which is probably what was intended, since only then the cast to short will
always have an argument that is within range.

With the original version, large widths produce settings which depend on the
least significant bits and thus tend to be rather random.

The topic has already be addressed in bug #43090, but the resolution which made
it into the final version does not solve the problem.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to