currencyStyle = xlwt.XFStyle()
currencyFont = xlwt.Font()
currencyFont.bold = False
currencyFont.name = 'Arial New'
currencyStyle.font = currencyFont
currencyStyle.format = '$#,##0'
Then I write lines in my spreadsheet like to:
sheet.write(currentRow, 4, '%.2f' %
float(record['valueDollars'] ), currencyStyle )
But they do not have the dollar sign or commas in the number. What am
I doing wrong? The output I would like looks so: $1,000.00
Any ideas?
Have you read the tutorial obtainable from http://www.python-excel.org ?
"easyxf" isn't just marketing hype, it really is easy (or at least
much easier) :-)
> Then I write lines in my spreadsheet like to:
> sheet.write(currentRow, 4, '%.2f' %
> float(record['valueDollars'] ), currencyStyle )
>
> But they do not have the dollar sign or commas in the number. What am
> I doing wrong? The output I would like looks so: $1,000.00
This might give you a clue: open your file with OOo Calc or Excel or
Gnumeric, and widen column E (rowx index == 4) to say twice its normal
width. Do the "numbers" cling to the right or to the left of the column?