John Yeung
unread,Jun 20, 2013, 5:22:26 PM6/20/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to python-excel
This is not even a specific proposal, let alone a request.
Right now, we can change the default font from Calibri 11 to Arial 10
by modifying the default format as follows:
from xlsxwriter.workbook import Workbook
wb = Workbook('myfile.xlsx')
wb.formats[0].font_name = 'Arial'
wb.formats[0].font_size = 10
(Or we can use the corresponding setter methods.) This is OK, I
guess, but not documented. I'm wondering if it makes sense to add
something friendlier. But even if so, I don't know what to add.
For example, it would be simple to grab the return value here
# Add the default cell format.
self.add_format({'xf_index': 0})
and give it a friendly name instead of discarding it. Or, if the
overwhelming use case for futzing with this format is to change the
font, then maybe a special setter function which accepts a name-size
tuple. Or allow another optional parameter to the workbook
constructor. Or maybe doing anything to the default format is too
esoteric, and formats[0] is just fine, tyvm.
In case it's not obvious, my own motivation for this is to let me set
up column widths (particularly autofit) based on the same character
widths I used with xlwt.
John Y.