def create_example_xls(self, filename):
    mkd = datetime.date
    hdngs = ['Date', 'Stock Code', 'Quantity', 'Unit Price', 'Value', 'Message']
    kinds = 'date    text          int         price         money    text'.split()
    data = ([[mkd(2007, 7, 1), 'ABC', 1000, 1.234567, 1234.57, ''], [mkd(2007, 12, 31), 'XYZ', (- 100), 4.654321, (- 465.43), 'Goods returned']] + ([[mkd(2008, 6, 30), 'PQRCD', 100, 2.345678, 234.57, '']] * 100))
    heading_xf = ezxf('font: bold on; align: wrap on, vert centre, horiz center')
    kind_to_xf_map = {'date': ezxf(num_format_str='yyyy-mm-dd'), 'int': ezxf(num_format_str='#,##0'), 'money': ezxf('font: italic on; pattern: pattern solid, fore-colour grey25', num_format_str='$#,##0.00'), 'price': ezxf(num_format_str='#0.000000'), 'text': ezxf()}
    data_xfs = [kind_to_xf_map[k] for k in kinds]
    write_xls(filename, 'Demo', hdngs, data, heading_xf, data_xfs)
def create_example_xls(self, filename):
    mkd = datetime.date
    hdngs = ['Date', 'Stock Code', 'Quantity', 'Unit Price', 'Value', 'Message']
    kinds = 'date    text          int         price         money    text'.split()
    data = ([[mkd(2007, 7, 1), 'ABC', 1000, 1.234567, 1234.57, ], [mkd(2007, 12, 31), 'XYZ', (- 100), 4.654321, (- 465.43), 'Goods returned']] + ([[mkd(2008, 6, 30), 'PQRCD', 100, 2.345678, 234.57, ]] * 100))
    heading_xf = ezxf('font: bold on; align: wrap on, vert centre, horiz center')
    kind_to_xf_map = {'date': ezxf(num_format_str='yyyy-mm-dd'), 'int': ezxf(num_format_str='#,##0'), 'money': ezxf('font: italic on; pattern: pattern solid, fore-colour grey25', num_format_str='$#,##0.00'), 'price': ezxf(num_format_str='#0.000000'), 'text': ezxf()}
    data_xfs = [kind_to_xf_map[k] for k in kinds]
    write_xls(filename, 'Demo', hdngs, data, heading_xf, data_xfs)