The width of the column is function not just of the number of characters, but also the width of each character, which is dependent on the font used. The reason why this functionality is not built into POI is for the lack of a good/usable font metric module. Its been discussed many times in the past, check the mailing list archives and there is an open RFE in bugzilla, i think.
Regards - Avik -------Original Message------- > From: Tim Wilkins <[EMAIL PROTECTED]> > Subject: Re: column width > Sent: 28 Oct 2003 16:14:52 > > Hmmm... I am planning to implement something like this for my self but have > not got around to doing it yet. I was planning on reading the character > length of each cell value in a column (I have to parse the whole document > anyway so should not be too much of an extra overhead). Then store the > maximum length I find for each column in an array and finally set the > column widths from the array. > > However if some functionality already exists to do this in POI that would > be great but I have not come across it. > > I know that in Excel itself you can double click on a column divider and it > will auto re-size the left hand column to the largest cell value but I > don't know if this functionality has been exposed in POI at present. > > Let us know if you come across anything! :) > > Tim > > At 03:52 PM 10/28/2003 -0400, you wrote: > >Hello > > > >I need the following functionality > > > >I'm creating a sheet which has several columns. > >I can't determine what will be the best width of a certain column. > > > >When you select a column and double click a border column will have a > >width of the cell, that is the maximum. So every cell in this column is > >visible. > > > >Is there a possibilty to do it programmatically with POI? > >I mean is there some method of a sheet or workbook or cell that does this > >thing? > > > >Thank you very much > >Vano > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > Tim Wilkins (Systems Analyst) > MediaTel Ltd > 84-86 Regent Street > London > W1B 5AJ > Tel: +44(0)20 7439 7575 > Fax: +44(0)20 7734 0940 > > MediaTel.co.uk's 140 subscribers include all 30 of the top UK media > agencies - responsible for over �6.4billion of media spend annually. > (source: Nielsen Media Research: Dec 01 - Nov 02) > > www.MediaTelGroup.co.uk > > MediaTel Group - Maximising efficiency across the entire media process. > > This message is for the named recipient's use only and may contain > confidential or privileged information. If you receive this message in > error, please immediately delete it and all copies of it from your system, > destroy any hard copies of it and notify the sender. You must not, directly > or indirectly, use, disclose, distribute, print, or copy any part of this > message if you are not the intended recipient. Email communications are not > secure and therefore the MediaTel Group does not accept liability for any > errors or omissions in the contents of this message which arise as a result > of email transmission. MediaTel reserves the right to monitor all email > communications through its networks. Any views expressed by an individual > in this email do not necessarily reflect the views of the MediaTel Group. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -------Original Message-------
