jango使用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行行高
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值