hiding a column in xlwt

1,358 views
Skip to first unread message

Alan Rotman

unread,
Nov 22, 2010, 7:53:13 AM11/22/10
to python-excel
Is there a way in xlwt to write a column, but have it hidden by
default?

I was able to define a column as a separate level, but then the user
in excel
has to "click on the '-' at the top of the sheet" to hide the column.
Defining a new level was taken from "xlwt/examples/outline.py".

Also, is there any date for when xlrd will support reading formulas?
This would be awesome !!
Since xlrd can't support formulas, I put hyperlink info in a "hidden
column".
Then xlrd can read a file and use the hidden-column to recreate
hyperlinks when writing the file back out.

P.S. I am really enjoying working with xlrd and xlwt - great job.

John Machin

unread,
Nov 22, 2010, 2:29:29 PM11/22/10
to python...@googlegroups.com
On 22/11/2010 11:53 PM, Alan Rotman wrote:
> Is there a way in xlwt to write a column, but have it hidden by
> default?

No. Columns are shown by default. You need to write some code to hide
the column(s) that you want hidden. Look at the first example script in
the xlwt section of the tutorial that's available from
http://www.python-excel.org

> I was able to define a column as a separate level, but then the user
> in excel
> has to "click on the '-' at the top of the sheet" to hide the column.

My recollection is that this could be arranged so that a level was
hidden ...

> Defining a new level was taken from "xlwt/examples/outline.py".
>
> Also, is there any date for when xlrd will support reading formulas?

No.

> This would be awesome !!

Yes.

> Since xlrd can't support formulas, I put hyperlink info in a "hidden
> column".

Ingenious. Other "what you can't see is what you get" techniques: (1)
Set your Font object's colour to the same as the background. (2) Easier:
Use a "number format" of ";;;" (that's 4 sections all empty).

> Then xlrd can read a file and use the hidden-column to recreate
> hyperlinks when writing the file back out.
>
> P.S. I am really enjoying working with xlrd and xlwt - great job.

Thanks for the kind words.

Cheers,
John


Reply all
Reply to author
Forward
0 new messages