AFAIK Autofit is a user triggered event not a state. i.e. when you are using
Excel you can highlight a column and double-click its column divider. This
will cause an autofit event to happen using the current data, font-metrics
etc. It doesn't matter if you change the font or data after that - the
column will stay the same width until you re-size it somehow. 

HTH

> -----Original Message-----
> From: Chris Cheshire [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 28, 2003 9:31 AM
> To: POI Users List
> Subject: Re: How do you set colum width to AutoFit
> 
> 
> I realise that the autofit is not a matter of a flag, but actually 
> calculating the max width of all data in that column, then 
> adjusting the 
> width for it accordingly, and that calculating the width is 
> the problem.
> 
> However, it appears that Excel is setting the column width in 
> a manner 
> that is independent of the font metrics anyway, so why does 
> poi have to?
> When playing around with fonts in a new sheet in excel, going from a 
> fixed width to a variable width, changing size etc, the only 
> thing that 
> changed was the row height, but not the column width. It stayed at a 
> default of "8.43 thingamajigs" (I don't know what unit excel 
> uses for this).
> 
> I am just try to understand this, not trying to be 
> argumentative. I am 
> sure there is a perfectly rational explanation for all of 
> this, despite 
> it being a microsoft product :)
> 
> Chris
> 
> Avik Sengupta wrote:
> 
> >Ok, here is my understanding, with all the usual disclaimers :)
> >
> >When we write out an excel file, what we have to do is 
> actually give the
> >column a physical width. It is NOT the case that we can set a flag on
> >the column saying "AutoFit", AFAIK. So we have to calculate the width
> >within POI, which depends on the content in the cell, which in turn
> >depends on the font size and weight, which is where the fort metrics
> >come in. (Font metrics, simply put, is the physical width of each
> >character for a particular font) The trouble with the classes in java
> >that provide font metrics are that they are dependent on X, and thus
> >cant be run from an unix terminal. We therefore need an 
> implementation
> >of font metrics that does not depend on any graphics classes. 
> >
> >Does that help? 
> >
> >Regards
> >-
> >Avik
> > 
> >
> >On Wed, 2003-05-28 at 21:07, Chris Cheshire wrote:
> >  
> >
> >>I have a question on this, which will show my lack of 
> understanding on 
> >>the subject. The archives say this needs to be implemented 
> in a manner 
> >>that is not dependant on font metrics. Fair enough. I took 
> this answer 
> >>for granted a while ago. However I have noticed something 
> when playing 
> >>around in excel - if I change the font and size of a column 
> under excel, 
> >>the column width never changes. If the width is dependant on font 
> >>metrics, wouldn't the width of the column change as the 
> font (and thus 
> >>the metrics) change? What am I missing here?
> >>
> >>Chris
> >>
> >>Avik Sengupta wrote:
> >>
> >>    
> >>
> >>>Cant be done yet, read the archives to understand why!
> >>>
> >>>On Wed, 2003-05-28 at 17:09, Shailesh Ligade wrote:
> >>> 
> >>>
> >>>      
> >>>
> >>>>Hello,
> >>>>
> >>>>I am not able to figure out how to use column Format 
> AutoFit. Can any
> >>>>one able to help me here?
> >>>>
> >>>>SL
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>-----------------------------------------------------------
> ----------
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>    
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >  
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to