> Something else that I'm not for sure about is that the column width is set
> for the whole column, but which cell does the metrics come from.
I think its the longest cell in the col. 

On Wed, 2003-05-28 at 22:15, Laubach Shawn Contr OC-ALC/PSB wrote:
> Chris, you are getting the width from excel itself which gives the units
> "thingamijigs" (good enough name).  The unites actually stored in the file
> is based upon the font metrics and can change without the number of
> thingamijigs changing in excel.  A simple test would be to create a sheet in
> excel with 2 columns the same width.  Put in the same text in a cell in both
> columns but different font,size, etc. and see what poi says the width of the
> column is.  You could also go the other way and create a similar sheet in
> hssf and see what excel says the widths are.
> 
> Shawn
> 
> Something else that I'm not for sure about is that the column width is set
> for the whole column, but which cell does the metrics come from.
> 
> -----Original Message-----
> From: Chris Cheshire [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 28, 2003 11: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]


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

Reply via email to