python - Formatted headers/footers? Colour Code -


i've found out way format header , footer using xlwt (see https://groups.google.com/forum/?fromgroups#!topic/python-excel/3hzp_hk_lsc),

i'm looking docs or example on how define font color header , footer? example.

according xlwt docs, can manage font, font style , font height. may have found there special &k (e.g. red &kff0000) notation header/footer font color, doesn't work xls (2003) format files.

if ok generate xlsx instead - can choose openpyxl or xlsxwriter.

here's example using openpyxl:

from openpyxl import workbook  wb = workbook() ws = wb.worksheets[0]  ws.header_footer.center_header.font_size = 14 ws.header_footer.center_header.font_name = "tahoma,bold" ws.header_footer.center_header.text = "hello, world!" ws.header_footer.center_header.font_color = "ff0000"  wb.save('output.xlsx') 

here's example using xlsxwriter:

from xlsxwriter.workbook import workbook  workbook = workbook('output.xlsx') worksheet = workbook.add_worksheet()  worksheet.set_header('&"tahoma,bold"&14&kff0000hello, world!')  workbook.close() 

hope helps.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -