I am using xlwt, excel sheet generation module for python. Basically I am trying to use some styles for the text. The coloring part works fine .i.e.
import xlwt
workbook = xlwt.Workbook(encoding='ascii')
worksheet = workbook.add_sheet('Test sheet')
worksheet.write(0, 0, "Hello World", xlwt.easyxf("pattern: pattern solid, fore_color yellow; font: color white;"))
There was a need to add alignment as well. I found this working
alignment = xlwt.Alignment()
alignment.horz = xlwt.Alignment.HORZ_RIGHT
horz_style = xlwt.XFStyle()
horz_style.alignment = alignment
worksheet.write(0, 0, "Hello World", horz_style)
But now whole thing is messed up since I can use only either the coloring or alignment.What I am trying is to integrate the alignment feature with xlwt.easyxf as well
Copyright Notice:Content Author:「beebek」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/19900972/text-alignment-in-xlwt-with-easyxf