ジャンゴxlwtコントロール細胞を使用する場合

マージされたセルの文言:

sheet.write_merge(top_row, bottom_row, left_column, right_column, '内容')

正常細胞の文言:

sheet.write(1, 0, 1)

オリジナルのポスト:
https://stackoverflow.com/questions/19672760/how-to-write-a-cell-with-multiple-columns-in-xlwt

セルの書式設定:

	response = HttpResponse(content_type='application/vnd.ms-excel')
	response['Content-Disposition'] = 'attachment;filename=order.xls'
    # 创建一个文件对象
    wb = xlwt.Workbook(encoding='utf8')
    sheet = wb.add_sheet('要求')
    sheet.col(0).width = 256 * 20  # 设置1列列宽
    sheet.col(1).width = 256 * 10  # 设置2列列宽
    tall_style = xlwt.easyxf('font:height 720')  # 行高36pt
    sheet.row(0).set_style(tall_style2) #设置1行行高
公開された11元の記事 ウォンの賞賛0 ビュー101

おすすめ

転載: blog.csdn.net/xiaotuwai8/article/details/104759330