Domanda

I am generating report and want to highlight the tab when its fails.

import xlrd    
import xlwt

wb = Workbook()    
add_result = wb.add_sheet(req_id[req_num])    
wb.save("report_name.xls")
È stato utile?

Soluzione

xl = Dispatch( "Excel.Application")

xl.Visible = False

xlFile = "C:/tab_colour.xls"

wkb = xl.Workbooks.Open(xlFile)

sheet = xl.Worksheets.Item("SVP INFO")

sheet.Tab.Color = 255

wkb.Save()

wkb.Close()

xl.Quit()

xl = None
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top