poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew C. Oliver" <acoli...@apache.org>
Subject Re: How can I set the column length to the content length
Date Mon, 21 Jul 2003 12:21:11 GMT
If you don't care about the ties to AWT (has implications on mainframes and
unix boxes), you can use the AWT FontMetrics class.  It doesn't *exactly*
match the Java versions of the fonts but you can probably get "good enough
for government work" as the phrase goes.

We have an RFE open on this:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6842

-andy


On 7/21/03 3:33 AM, "hotmail" <alan4322@hotmail.com> wrote:

> Hi,everyone:
> How can I set the column length to the content length.
> I have used this method:
> String content = "blah,blah,balh";
> int length = content.getBytes().lenght;
> sheet.setColumnWidth((short)1, (short)length*256);
> 
> But, I think this is very boring. Is there a function, which I can call and it
> will set the perfect column length to equal to the most widest content length.
> 
> Regards
> 
> Alan

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


Mime
View raw message