Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Bug in row.height ?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
John Machin  
View profile  
 More options Dec 30 2009, 10:10 pm
From: John Machin <sjmac...@lexicon.net>
Date: Thu, 31 Dec 2009 14:10:31 +1100
Local: Wed, Dec 30 2009 10:10 pm
Subject: Re: [pyxl] Bug in row.height ?
On 31/12/2009 1:00 PM, John Yeung wrote:

> If only I had read this more carefully when I first opened it, I could
> have saved myself hours of painful BIFF-documentation-reading and
> bit-by-bit (byte-reversed!) file inspection.  (More comments below.)

A wise person once said: You can lead a horse to water, tie a brick to
its nose, and kick it in the fundament with a size 12 Doc but you can't
make it drink :-)

> On Mon, Dec 28, 2009 at 6:18 PM, John Machin <sjmac...@lexicon.net> wrote:
>> Assuming hidden=0, collapsed=0, has_default_height=0, as far as I can
>> tell the following rules are applied:

>> A. If height_mismatch is true, Excel will use the requested height. In
>> other words, font doesn't match requested height, so go with the
>> requested height. If the font is small, you get space. If the font is
>> large, you get chopped characters.

>> B. Else: (1) Excel will calculate a row height high enough to accomodate
>> the tallest font used in the row. (2) If any cell in the row is styled
>> with "alignment: wrap on" and the text is too long to fit in the column
>> width, Excel will calculate a row height sufficient to accomodate
>> wrapping all such cells within their column width.

> Given behavior A (which I independently discovered through much effort
> earlier today), I suggest the "tutorial" (de facto manual, available
> at python-excel.org as python-excel.pdf) be updated, because it
> currently says

> "Do not be fooled by the height attribute of the Row class, it does
> nothing.  Specify a style on the row and set its font height attribute
> instead."

That's a very sound suggestion.

> The height attribute certainly does more than nothing when combined
> with height_mismatch.  The font-based solution has its merits, but
> isn't a perfect substitute for being able to pick a specific row
> height.

> As a vague idea (weaker than a suggestion), it might be easier, or at
> least less cryptic, to add a Row.set_height method and point people to
> it in the tutorial, than to explain in the tutorial that they have to
> set both height and height_mismatch.

Your vague idea covers behaviour A, leaving the tutorial to explain that
if behaviour B is required, they must not set height_mismatch to True
etc etc. Your proposed method would do nothing else but set the height
attribute to the arg value and setting height_mismatch to 1. Do you plan
on not documenting why height_mismatch is set to 1? Perhaps you'd like
to explain what you mean by "easier" and "less cryptic".

> Oh, it might be useful to mention that the reason I was investigating
> setting the row height in the first place was because I couldn't coax
> Excel into doing automatic height adjustment to accommodate wrapped
> text in merged cells.

I presume you didn't read far enough into that cryptic message to get to
the mention of the demo script :-(

>  (As far as I can tell, this is a bug in Excel
> 2000 and doesn't imply any deficiency in xlwt.)

Can you produce the required behaviour using the Excel UI?

Cheers,
John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.