Upgrading the output formatting?
Any plans to upgrade the formatting options for the output? As a minimum, we would need row- or column-based options for formatting; width/height; colors (fore & back); fonts etc.
It would also be helpful to define sheet sections; header, body & footer into which data can be written (e.g. to handle column totals).
I didn't have any solid plans at the moment, but that does sound like a solid idea. Do you have any kind of proposal for how this would work, perhaps what the API would look like?
This library started out to handle a very simple use case, so I didn't really have any of that in mind when I originally designed it. I would love to be able to produce more complex output though.
I know your tool is based on openpyxl - I see there is good support for different formats: https://openpyxl.readthedocs.io/en/default/styles.html - but it might be possible to provide wrappers around this e.g. pass in a dictionary with styles to format single, or ranges of rows or columns for a given sheet e.g. as crude JSON:
{
"styles": [{
"sheet_name": "One",
"formats": {
"rows": [{
"start": 0,
"end": 2,
"height": 2.0,
"foreground": "red",
"background": "blue",
"pattern": "diagonal"
},
{
"start": 3,
"height": 3.0,
"foreground": "blue",
"pattern": "vertical",
"font-weight": "italics"
}],
"cols": [{
"start": 3,
"width": 3.0,
"font-color": "red",
"font-weight": "bold",
"font-size": 16
}]
}
}]
}
(end is optional; if omitted, just apply to a single row/column)
One could get even fancier and allow formatting of individual cells (for example; it might be the one containing the Grand Total).
May also be useful to define a base style that applies to the whole sheet e.g. the default font name and size, or default row height.
Footnote: My primary tool is xlsxwriter (http://xlsxwriter.readthedocs.io/), so I am working with that now to set up a similar approach; would be useful to have a tool that can support both libraries!
@gamesbook I'll try to put some thought into this. That looks like a good start for a proposal. I may not be able to get to implementing it immediately, but I'm always open to pull requests!