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


Yegor Kozlov <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




--- Comment #6 from Yegor Kozlov <[email protected]>  2009-02-06 10:40:37 PST ---
Nick's supposition is right, it is a signed vs unsiged 16 bit integer issue.

1. The following fragment (lines 64-66) is wrong:

                float cellWidth = convertPixelsToCharacters(columnWidths[c] *
256f);

                sheet.setColumnWidth((short) (columnIndex), (short) cellWidth);

If cellWidth > Short.MAX_VALUE then the casting to short produces a negative
value.

2. setColumnWidth / getColumnWidth with short arguments are deprecated. 
Use
setColumnWidth(int columnIndex, int width) 
and 
int getColumnWidth(int columnIndex) 

In particular, getColumnWidth(short columnIndex)  return a short value. If
column width measured in 1/256th units is in the interval [32767, 65536] 
then this method returns a negative value which is evidently incorrect.

3. The maximum column width for an individual cell in Excel is 255 characters.
I changed the code to throw IllegalArgumentException if this limit is exceeded.

Regards,
Yegor


-- 
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