[pyxl] XlsxWriter nearly feature-complete

375 views
Skip to first unread message

John Yeung

unread,
Apr 1, 2013, 9:31:28 PM4/1/13
to python-excel
The latest flurry of features seems to grab all the remaining
low-hanging fruit as far as I'm concerned. (I don't even know what
some of the not-yet-ported features are supposed to do.) I will
definitely be doing some more testing in the coming weeks.

John Y.

Josh English

unread,
Apr 4, 2013, 12:55:02 PM4/4/13
to python...@googlegroups.com

I would like to know if it's possible to add borders to cells once they are already written. 

For example, I am writing lots of table that I like to have small borders between individual cells, but a thick border around the whole table.

It seems like the only way to get this to work is to define nine separate formats for a simple table and determine which format to use It could really take 27 or even 36 formats for most of my work. It seems awfully complicated.

I know in Excel I can just add these borders as I need to, but I would like to be able to add a border inside the file creation itself.

Other than that, XlsxWriter is doing everything I want it to do. 

John Yeung

unread,
Apr 4, 2013, 2:00:00 PM4/4/13
to python-excel
On Thu, Apr 4, 2013 at 12:55 PM, Josh English
<joshua.r...@gmail.com> wrote:
> I would like to know if it's possible to add borders to cells once they are
> already written.

In a literal sense, no. The very act of writing a cell involves
writing (a reference to) the format as well.

> It seems like the only way to get this to work is to define nine separate
> formats for a simple table and determine which format to use It could really
> take 27 or even 36 formats for most of my work. It seems awfully
> complicated.

Easier border-handling for rectangular ranges is a common request for
xlwt as well. The problem is that in terms of the file format, it
really is that complicated. Especially so if you want to be
economical with respect to the number of formats used.

It's possible to add this enhancement, of course, just not in as
straightforward a manner as the Excel GUI makes it seem. (Excel is a
massive program that does a huge amount of work behind the scenes.)

John Y.

Josh English

unread,
Apr 4, 2013, 4:11:20 PM4/4/13
to python...@googlegroups.com
I figured it was like this. I'm sure under the hood the new styles are being created all the time. I'ts just a pain to have to tweak every sheet in several ways to make it "boss-ready"


John McNamara

unread,
Apr 7, 2013, 3:15:26 PM4/7/13
to python...@googlegroups.com


On Thursday, 4 April 2013 17:55:02 UTC+1, Josh English wrote:

I would like to know if it's possible to add borders to cells once they are already written. 

For example, I am writing lots of table that I like to have small borders between individual cells, but a thick border around the whole table.

It seems like the only way to get this to work is to define nine separate formats for a simple table and determine which format to use It could really take 27 or even 36 formats for most of my work. It seems awfully complicated.


Hi Josh,

This is mentioned in the FAQ because it was the most commonly requested feature in my previous Excel writing module. As John Yeung points out the Excel file format doesn't make it easy to do but it is possible with a bit of work and XlsxWriter is structured internally to allow it in the future. 

I really can see the need for it. It would be better to be able to add formats to cells separately from the data and to define borders around a range of cells. 

Hopefully, I'll get to implement it in the future.

On a slightly related note, the latest release of XlsxWriter, 0.2.9, adds worksheet Tables which are a way of defining formatting to a table (range) of data. However, that isn't their primary function. Have a look at the new section in the docs, "Working with Worksheet Tables":


Finally, in terms of ported features, XlsxWriter *is* nearly complete. There are still 2 outstanding mainline features: Sparklines and Charts. Sparklines will be completed in the next few days and after that I will tackle Charts. That is quite a large feature but all going well it should be available in some form before the end of April.

Thanks for the input guys, keep it coming.

John


Reply all
Reply to author
Forward
0 new messages