You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Thorsten Bux <Th...@gmx.de> on 2008/09/15 13:03:16 UTC

Error in methode sheet.getColumnWidth(0)?

Hi,

i tried to get the width of a column with the sheet.getColumnWidth(0) method.
If the column width in excel is bigger than a specific size (i think bigger 127 / 890px) then the method sheet.getColumnWidht(0) returns a negative value.

Is this a bug?

Thanks for your help
Thorsten
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

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


Re: Error in methode sheet.getColumnWidth(0)?

Posted by Thorsten Bux <Th...@gmx.de>.
-------- Original-Nachricht --------
> Datum: Tue, 16 Sep 2008 14:46:31 +1000
> Von: Daniel Noll <da...@nuix.com>
> An: POI Users List <us...@poi.apache.org>
> Betreff: Re: Error in methode sheet.getColumnWidth(0)?

> Thorsten Bux wrote:
> > Hi,
> > 
> > actually I really need this method to work. So can you tell me when
> > the problem would be fixed or if there is any workaround.
> 
> Assuming you've filed the bug already (one wouldn't expect it to be 
> fixed *before* the bug report is filed), as usual with open source the 
> quickest way to get something fixed is to fix it yourself and submit the 
> patch.
> 
> I'll give you a start though, as Nick was more than likely right:
> 
>    - ColumnInfoRecord, make field_3_col_width an int and make
>      getColumnWidth() return int.  (Have it read as a UInt16.)
>    - Sheet.getColumnWidth, make that return int also, and use int for
>      retval
>    - HSSFSheet.getColumnWidth, make that return int also.
> 
> HTH
> 
> Daniel
> 
> PS: surely the workaround is to add 65536 if it returns a
>      negative number.
> 
> 
> 
> -- 
> Daniel Noll
> 

Hi,

thanks for your help. I already recorded this bug.
Actually I have no idea how to fix that problem on my own. But the workaround by adding 65536 to the negative number seams to work fine.

Best regards
Thorsten
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser

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


Re: Error in methode sheet.getColumnWidth(0)?

Posted by Daniel Noll <da...@nuix.com>.
Thorsten Bux wrote:
> Hi,
> 
> actually I really need this method to work. So can you tell me when
> the problem would be fixed or if there is any workaround.

Assuming you've filed the bug already (one wouldn't expect it to be 
fixed *before* the bug report is filed), as usual with open source the 
quickest way to get something fixed is to fix it yourself and submit the 
patch.

I'll give you a start though, as Nick was more than likely right:

   - ColumnInfoRecord, make field_3_col_width an int and make
     getColumnWidth() return int.  (Have it read as a UInt16.)
   - Sheet.getColumnWidth, make that return int also, and use int for
     retval
   - HSSFSheet.getColumnWidth, make that return int also.

HTH

Daniel

PS: surely the workaround is to add 65536 if it returns a
     negative number.



-- 
Daniel Noll

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


Re: Error in methode sheet.getColumnWidth(0)?

Posted by Thorsten Bux <Th...@gmx.de>.
Hi,

actually I really need this method to work. So can you tell me when the problem would be fixed or if there is any workaround.

Thanks
Thorsten

-------- Original-Nachricht --------
> Datum: Mon, 15 Sep 2008 12:06:03 +0100 (BST)
> Von: Nick Burch <ni...@torchbox.com>
> An: POI Users List <us...@poi.apache.org>
> Betreff: Re: Error in methode sheet.getColumnWidth(0)?

> On Mon, 15 Sep 2008, Thorsten Bux wrote:
> > i tried to get the width of a column with the sheet.getColumnWidth(0) 
> > method. If the column width in excel is bigger than a specific size (i 
> > think bigger 127 / 890px) then the method sheet.getColumnWidht(0) 
> > returns a negative value.
> 
> Probably a unsigned 16 bit vs signed 16 bit issue. Probably best if you 
> create a new bug on bugzilla, and upload a simple test case that shows it 
> up.
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org

-- 
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196

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


Re: Error in methode sheet.getColumnWidth(0)?

Posted by Nick Burch <ni...@torchbox.com>.
On Mon, 15 Sep 2008, Thorsten Bux wrote:
> i tried to get the width of a column with the sheet.getColumnWidth(0) 
> method. If the column width in excel is bigger than a specific size (i 
> think bigger 127 / 890px) then the method sheet.getColumnWidht(0) 
> returns a negative value.

Probably a unsigned 16 bit vs signed 16 bit issue. Probably best if you 
create a new bug on bugzilla, and upload a simple test case that shows it 
up.

Nick

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