Is there any way to set a Column() width to "autofit"?
It's not ludicrous to roll your own, though. (Well, not what I
consider ludicrous. Naturally others will disagree.) The simplest,
most accurate, and fastest-executing way would be to first pick a
monospaced font. The main trickiness then would be accounting for
formatting choices (numeric or date separators and the like).
Actually, in my opinion, that's the main trickiness regardless.
Compared to accounting for formatting, using a proportional font is
pretty easy, it's just more computationally intensive. If you have
access to the target machine (or an identically configured one), you
can even determine the relative widths of the characters empirically.
(I've done this for Arial 10 on the PC I use at work; this would be
approximately right for most folks using Arial. I can provide this
upon request.)
John Y.
--
You received this message because you are subscribed to the Google Groups "python-excel" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/python-excel/-/W0pW6Pf7wF4J.
To post to this group, send an email to python...@googlegroups.com.
To unsubscribe from this group, send email to python-excel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
Michael