tags:

views:

115

answers:

3

I work on a python(django) project. I write csv code as follows,

response = HttpResponse(mimetype='text/csv')    
response['Content-Disposition'] = 'attachment; filename=DueDateWiseSearch.csv'    
writer =  csv.writer(response)    
writer.writerow(['Infant Name','Mother Name','Mother Address',
     'Next Vaccine Dose','Due date','Coments'])

this row is the header and I need to bold all header text. I download csv as ms "Excel" file.

How can I do it? Please help!

+4  A: 

There's no way to do that in CSV. You could all caps the output, or you could use another format that supports text styles.

TokenMacGuy
+1  A: 

There is no way to do that with CSV that I know of, but you might consider using the old SYLK format or Office XML format.

mkoistinen
thanks!for your quick reply.
Goldenagebd
+1  A: 

CSV only contains data, it doesn't contain any formatting information. If you need to format your data, I'd suggest actually creating an XLS file instead of a CSV file. Try using something like xlwt.

Tauren
-1 pyexcelerator is abandonware. Use xlwt instead.
John Machin
thanks!for your quick reply.
Goldenagebd
@John, thanks for pointing that out. I haven't used pyexcelerator before, or had a need to export XLS. It just came up first in google. I'll change my answer to be more accurate.
Tauren