import xlwt
wb = xlwt.Workbook()
sh = wb.add_sheet('电影')
sh.row(3).height_mismatch = True
sh.row(3).height = 5 * 256
sh.col(3).width = 5 * 256
sh.col(4).width = 5 * 256
alg = xlwt.Alignment()
alg.horz = 2
alg.vert = 1
border = xlwt.Borders()
border.left = 1
border.right = 1
border.top = 1
border.bottom = 1
border.left_colour = 1
border.right_colour = 2
border.top_colour = 3
border.bottom_colour = 4
pattern = xlwt.Pattern()
pattern.pattern = xlwt.Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 5
ft = xlwt.Font()
ft.name = '微软雅黑'
ft.colour_index = 2
ft.height = 11 * 20
ft.bold = True
ft.underline = True
ft.italic = True
style = xlwt.XFStyle()
style.font = ft
style.alignment = alg
style.borders = border
style.pattern = pattern
style5 = xlwt.easyxf(
'font: bold on, color_index 6; align: vert center, horiz center')
sh.write(0, 0, '电影', style)
sh.write(0, 1, '票房/亿', style)
sh.write(1, 0, '《捉妖记2》', style5)
sh.write(1, 1, 22.37, style5)
sh.write(2, 0, '《后来的我们》')
sh.write(2, 1, 13.61)
sh.write(3, 0, '《我不是药神》')
sh.write(3, 1, 31)
sh.write(4, 0, '《西虹市首富》')
sh.write(4, 1, 25.47)
sh.write(5, 0, '《红海行动》')
sh.write(5, 1, 36.5)
wb.save('./办公自动化/files/电影.xls')