本文整理汇总了Python中xlwt.Borders.bottom方法的典型用法代码示例。如果您正苦于以下问题:Python Borders.bottom方法的具体用法?Python Borders.bottom怎么用?Python Borders.bottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xlwt.Borders
的用法示例。
在下文中一共展示了Borders.bottom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: css2excel
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def css2excel(css):
#custom_css = 'font: name "%s", %s on'%(current_value['font-family'].split(",")[0], current_value['font-weight'].split(",")[0])
#export_sheet.write(row_idx, col_idx, current_value['data'], xlwt.easyxf('font: italic on; pattern: pattern solid, fore-colour grey25'))
xf_list = []
fnt = Font()
borders = Borders()
pattern = Pattern()
align = Alignment()
process_css = {
'font-family' : [fnt, "name" , lambda x : x.split(",")[0]],
'color' : [fnt, "colour_index", lambda x : excel_color_map.get(x,0)+8],
'font-weight' : [fnt, "bold", lambda x : x.upper() == 'BOLD'],
#'font-weight' : [fnt, "bold", lambda x : x == '700'],
'text-align' : [align, "horz", lambda x : {'left':align.HORZ_LEFT, 'right':align.HORZ_RIGHT, 'center':align.HORZ_CENTER, 'justified': align.HORZ_JUSTIFIED}[x]],
'background-color' : [pattern,"pattern_fore_colour", lambda x: excel_color_map.get(x,16)+8],
}
#TODO process_css -> css
for i in process_css.keys():
#print process_css[i][0] ,".",process_css[i][1], " => " , css[i] ," | ", process_css[i][2](css[i])
setattr(process_css[i][0], process_css[i][1], process_css[i][2](css[i]))
style = XFStyle()
style.font = fnt
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
style.borders = borders
style.pattern = pattern
style.pattern.pattern = 1
style.alignment = align
return style
示例2: getDefualtStyle
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def getDefualtStyle():
fnt = Font()
fnt.name = 'Arial'
borders = Borders()
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
#pattern = Pattern()
#pattern.pattern = Style.pattern_map['solid']
###pattern.pattern_back_colour = 0xBFBFBF
#pattern.pattern_fore_colour = 0x37
alignment = Alignment()
#alignment.horizontal = Alignment.HORZ_LEFT
alignment.horizontal = Alignment.HORZ_RIGHT
style = XFStyle()
#~ style.num_format_str='0.000%'
#~ style.num_format_str='0+'
#~ style.font = fnt
style.align = alignment
#style.borders = borders
#~ style.pattern = pattern
return style
示例3: excel_style
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def excel_style():
borders_amount = Borders()
borders_amount.right = Borders.THIN
borders_amount.top = Borders.THIN
borders_amount.bottom = Borders.THIN
borders_name = Borders()
borders_name.left = Borders.THIN
borders_name.right = Borders.THIN
borders_name.top = Borders.THIN
borders_name.bottom = Borders.THIN
style_amount = XFStyle()
style_amount.borders = borders_amount
style_name = XFStyle()
style_name.borders = borders_name
return style_amount, style_name
示例4: __init__
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def __init__(self, ws, headers, header_line_no=0, use_borders=False, styleHeaders=None, styleDict={}, widths={}):
self.headers = headers
self.header_line_no = header_line_no
self._currentRowIndex = self.header_line_no + 1
self.ws = ws
self.rows = []
# columnn widths
if isinstance(widths, dict):
self._explicit_widths = True
self.__colwidths = widths
else:
self._explicit_widths = False
self.__colwidths = {i:len(h) for i,h in enumerate(self.headers)}
#***************************************************************************
borders = Borders()
if use_borders is True:
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
self.normStyle = XFStyle()
self.normStyle.font = normFont
if use_borders:
self.normStyle.borders = borders
# headers
if not isinstance(styleHeaders, XFStyle):
self.styleHeaders = XFStyle()
self.styleHeaders.font = fntHeaders
self.styleHeaders.borders = borders
else:
self.styleHeaders = styleHeaders
# for date fields if no styleDict
self.styleDate = XFStyle()
self.styleDate.borders = borders
self.styleDate.num_format_str = 'MM/DD/YYYY'
self.styleDate.font = normFont
#***************************************************************************
#
# instance styles defined by user or defaults
if all(map(lambda s: isinstance(s, XFStyle), styleDict.values())):
self.styleDict = styleDict
if DEFAULT_STYLE in styleDict:
self._defaultStyle = self.styleDict[DEFAULT_STYLE]
else:
self.styleDict = {}
self._defaultStyle = self.normStyle
self.writeHeaders()
示例5: setupFormat
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def setupFormat(self):
headFont = Font()
headFont.bold = True
alignmentSetup = Alignment()
alignmentSetup.wrap = True
borders = Borders()
borders.left = 1
borders.right = 1
borders.top = 1
borders.bottom = 1
self.header_style = XFStyle()
self.header_style.font = headFont
self.table_style = XFStyle()
self.table_style.borders = borders
self.table_style.alignment = alignmentSetup
示例6: estiloCeldasSeparadas
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def estiloCeldasSeparadas():
fnt = Font()
fnt.bold=True
#fnt.colour_index=2
borders = Borders()
borders.left = Borders.MEDIUM
borders.right = Borders.MEDIUM
borders.top = Borders.MEDIUM
borders.bottom = Borders.MEDIUM
pattern = Pattern()
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 0x18#0x99
style = XFStyle()
style.num_format_str='YYYY-MM-DD'
style.font = fnt
style.borders = borders
style.pattern = pattern
return style
示例7: __init__
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def __init__(self):
self.style = XFStyle()
base_font = Font() # 设置基本字体
base_font.height = FONT_SIZE_UNIT * 12
self.style.font = base_font
alignment = Alignment() # 设置对齐
alignment.horz = Alignment.HORZ_CENTER
alignment.vert = Alignment.VERT_CENTER
self.style.alignment = alignment
borders = Borders() # 设置边框
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
borders.left_colour = COLOUR_BLACK
borders.right_colour = COLOUR_BLACK
borders.top_colour = COLOUR_BLACK
borders.bottom_colour = COLOUR_BLACK
self.style.borders = borders
self.style.num_format_str = '#,##0' # 设置数字格式
示例8: transCellData_summary
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def transCellData_summary(pos,val):
tmp=[]
tmp.append(transpos(pos)[0])
tmp.append(transpos(pos)[1])
style = getDefualtStyle()
style.font.colour_index =0x17
style.alignment.horz = Alignment.HORZ_CENTER
#style.borders.right = Borders.NO_LINE
style.font.bold =True
borders = Borders()
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
style.borders = borders
try:
tmp.append(val)
except:
tmp.append(0)
return tmp,style
示例9: creaHojaDeTraduccion
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def creaHojaDeTraduccion(excel, nombreHoja="traduccion"):
hoja=excel.creaHoja(nombreHoja)
hoja.col(0).width=90*256
hoja.col(1).width=20*256
fnt = Font()
fnt.bold=True
#fnt.colour_index=2
borders = Borders()
borders.left = Borders.MEDIUM
borders.right = Borders.MEDIUM
borders.top = Borders.MEDIUM
borders.bottom = Borders.MEDIUM
pattern = Pattern()
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 0x18#0x99
style = XFStyle()
style.num_format_str='YYYY-MM-DD'
style.font = fnt
style.borders = borders
style.pattern = pattern
hoja.write(0,0,"Original Text",style)
hoja.write(0,1,"Translation",style)
return hoja
示例10: detail_budget
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def detail_budget(self,cr,uid,ids,context=None):
this=self.browse(cr,uid,ids[0])
year = this.year_id.name
year_id = this.year_id.id
month = this.month
if month == '1':
month_name = 'January'
elif month == '2':
month_name = 'February'
elif month == '3':
month_name = 'March'
elif month == '4':
month_name = 'April'
elif month == '5':
month_name = 'May'
elif month == '6':
month_name = 'June'
elif month == '7':
month_name = 'July'
elif month == '8':
month_name = 'August'
elif month == '9':
month_name = 'September'
elif month == '10':
month_name = 'October'
elif month == '11':
month_name = 'November'
elif month == '12':
month_name = 'December'
else:
raise osv.except_osv(_('Warning !'),_("Specify month correctly. "))
if int(month) in [1,3,5,7,8,10,12]:
join_date=year +'-'+month+'-'+'31'
if int(month) in [4,6,9,11]:
join_date=year +'-'+month+'-'+'30'
if int(month) in [2]:
if int(year) % 4 == 0:
join_date=year +'-'+month+'-'+'29'
else:
join_date=year +'-'+month+'-'+'28'
#Define the font attributes for header
fnt = Font()
fnt.name = 'Arial'
fnt.height= 275
#Define the font attributes for header
content_fnt = Font()
content_fnt.name ='Arial'
content_fnt.height =220
align_content = Alignment()
align_content.horz= Alignment.HORZ_CENTER
borders = Borders()
borders.left = 0x02
borders.right = 0x02
borders.top = 0x02
borders.bottom = 0x02
#The text should be centrally aligned
align = Alignment()
align.horz = Alignment.HORZ_CENTER
align.vert = Alignment.VERT_CENTER
#We set the backgroundcolour here
pattern = Pattern()
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 0x1F
#apply the above settings to the row(0) header
style_header= XFStyle()
style_header.font= fnt
style_header.pattern= pattern
style_header.borders = borders
style_header.alignment=align
#Define the font attributes for header
fnt1 = Font()
fnt1.name = 'Arial'
fnt1.height= 275
#Define the font attributes for header
content_fnt1 = Font()
content_fnt1.name ='Arial'
content_fnt1.height =220
align_content1 = Alignment()
align_content1.horz= Alignment.HORZ_CENTER
borders1 = Borders()
borders1.left = 0x02
borders1.right = 0x02
borders1.top = 0x02
borders1.bottom = 0x02
#The text should be centrally aligned
align1 = Alignment()
align1.horz = Alignment.HORZ_CENTER
align1.vert = Alignment.VERT_CENTER
#We set the backgroundcolour here
#.........这里部分代码省略.........
示例11: account_budget
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def account_budget(self,cr,uid,ids,context=None):
this=self.browse(cr,uid,ids[0])
year = this.year_id.name
year_id = this.year_id.id
month = this.month
if int(month) in [1,3,5,7,8,10,12]:
join_date=year +'-'+month+'-'+'31'
if int(month) in [4,6,9,11]:
join_date=year +'-'+month+'-'+'30'
if int(month) in [2]:
if int(year) % 4 == 0:
join_date=year +'-'+month+'-'+'29'
else:
join_date=year +'-'+month+'-'+'28'
if month == '1':
month_name = 'January'
elif month == '2':
month_name = 'February'
elif month == '3':
month_name = 'March'
elif month == '4':
month_name = 'April'
elif month == '5':
month_name = 'May'
elif month == '6':
month_name = 'June'
elif month == '7':
month_name = 'July'
elif month == '8':
month_name = 'August'
elif month == '9':
month_name = 'September'
elif month == '10':
month_name = 'October'
elif month == '11':
month_name = 'November'
elif month == '12':
month_name = 'December'
else:
raise osv.except_osv(_('Warning !'),_("Specify month correctly. "))
#Define the font attributes for header
fnt = Font()
fnt.name = 'Arial'
fnt.height= 275
#Define the font attributes for header
content_fnt = Font()
content_fnt.name ='Arial'
content_fnt.height =220
align_content = Alignment()
align_content.horz= Alignment.HORZ_CENTER
borders = Borders()
borders.left = 0x02
borders.right = 0x02
borders.top = 0x02
borders.bottom = 0x02
#The text should be centrally aligned
align = Alignment()
align.horz = Alignment.HORZ_CENTER
align.vert = Alignment.VERT_CENTER
#We set the backgroundcolour here
pattern = Pattern()
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 0x1F
#apply the above settings to the row(0) header
style_header= XFStyle()
style_header.font= fnt
style_header.pattern= pattern
style_header.borders = borders
style_header.alignment=align
#Define the font attributes for header
fnt1 = Font()
fnt1.name = 'Arial'
fnt1.height= 275
#Define the font attributes for header
content_fnt1 = Font()
content_fnt1.name ='Arial'
content_fnt1.height =220
align_content1 = Alignment()
align_content1.horz= Alignment.HORZ_CENTER
borders1 = Borders()
borders1.left = 0x02
borders1.right = 0x02
borders1.top = 0x02
borders1.bottom = 0x02
#The text should be centrally aligned
align1 = Alignment()
align1.horz = Alignment.HORZ_CENTER
align1.vert = Alignment.VERT_CENTER
#We set the backgroundcolour here
#.........这里部分代码省略.........
示例12: exportToExcel
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def exportToExcel(self,objectProject):
book = Workbook();
sheet1 = book.add_sheet('Sheet 1')
sheet1.col(1).width = 256*20;
sheet1.col(2).width = 256*80;
sheet1.col(3).width = 256*10;
sheet1.col(4).width = 256*20;
default_book_style = book.default_style
default_book_style.font.height = 20 * 36 # 36pt
fnt = Font()
fnt.name = 'Arial'
fnt.colour_index = 4
fnt.bold = True
borders = Borders()
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
pattern = Pattern();
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 23
algn1 = Alignment();
algn1.wrap = 1;
#algn1.horz = Alignment.HORZ_CENTER
#algn1.vert = Alignment.VERT_TOP
alignHeader = Alignment();
alignHeader.horz = Alignment.HORZ_CENTER;
alignTop = Alignment();
alignTop.vert = Alignment.VERT_TOP
print "export";
if( objectProject):
i=0;
print "start" ;
styleHead = XFStyle();
styleHead.font = fnt;
styleHead.borders = borders;
styleHead.pattern = pattern;
styleHead.alignment = alignHeader;
row1 = sheet1.row(i) ;
row1.write(0, ('risk id').decode('UTF8'),styleHead );
sheet1.write_merge(i, i, 1, 2, ('รายละเอียด').decode('UTF8') ,styleHead );
# row1.write(1, ('รายละเอียด').decode('UTF8'));
row1.write(3, ('วันที่รายงาน').decode('UTF8'), styleHead );
row1.write(4, ('หน่วยที่รายงาน').decode('UTF8'), styleHead );
i=i+1;
style1 = XFStyle();
style1.alignment = algn1;
#style0 = xlwt.easyxf('font: name Times New Roman size 20, color-index black, bold on')
for value in objectProject:
row1 = sheet1.row(i) ;
styleRowDetail = XFStyle();
styleRowDetail.borders = borders;
styleRowDetail.alignment = alignTop;
StyleRowDetailWrap = styleRowDetail ;
StyleRowDetailWrap.alignment = algn1;
styleDate = XFStyle()
styleDate.num_format_str = 'DD-MM-YYYY' ; #'D-MMM-YY';
styleDate.borders = borders;
row1.write(0, value.get('risk_management_id'),styleRowDetail );
#row1.write(1, value.get('risk_detail').decode('UTF8') , style1);
sheet1.write_merge(i, i, 1, 2, value.get('risk_detail').decode('UTF8') , StyleRowDetailWrap );
row1.write(3, value.get('report_date') ,styleDate);
row1.write(4, value.get('report').decode('UTF8') ,styleRowDetail );
i=i+1;
row1 = sheet1.row(i) ;
row1.write(0," " );
row1.write(1,('หน่วยที่เกี่ยวข้อง').decode('UTF8') ,styleHead );
sheet1.write_merge(i, i, 2, 3,('รายละเอียดการตอบ').decode('UTF8') , styleHead );
i=i+1;
for sub in value.get('response') :
row1 = sheet1.row(i) ;
row1.write(0," " );
row1.write(1,sub.get('risk_team').decode('UTF8') , styleRowDetail );
#.........这里部分代码省略.........
示例13: exportReport5ToExcel
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def exportReport5ToExcel(self,objectProject):
book = Workbook();
sheet1 = book.add_sheet('Sheet 1');
sheet1.col(1).width = 256*80;
sheet1.col(2).width = 256*10;
sheet1.col(3).width = 256*20;
borders = Borders()
borders.left = Borders.THIN
borders.right = Borders.THIN
borders.top = Borders.THIN
borders.bottom = Borders.THIN
pattern = Pattern();
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 23
wrap = Alignment();
wrap.wrap = 1;
wrap.vert = Alignment.VERT_TOP
alignHeader = Alignment();
alignHeader.horz = Alignment.HORZ_CENTER;
alignTop = Alignment();
alignTop.vert = Alignment.VERT_TOP
fnt = Font()
fnt.name = 'Arial'
fnt.colour_index = 4
fnt.bold = True
styleWrap = XFStyle();
styleWrap.alignment = wrap;
styleHead = XFStyle();
styleHead.font = fnt;
styleHead.borders = borders;
styleHead.pattern = pattern;
styleHead.alignment = alignHeader;
styleRowDetail = XFStyle();
styleRowDetail.borders = borders;
styleRowDetail.alignment = alignTop;
styleDate = XFStyle()
styleDate.num_format_str = 'DD-MM-YYYY' ; #'D-MMM-YY';
styleDate.borders = borders;
styleDate.alignment = alignTop;
StyleRowDetailWrap = styleRowDetail ;
StyleRowDetailWrap.alignment = wrap;
if( objectProject):
i=0;
row1 = sheet1.row(i) ;
row1.write(0, ('risk id').decode('UTF8'),styleHead );
#sheet1.write_merge(i, i, 1, 2, ('รายละเอียด').decode('UTF8') );
row1.write(1, ('รายละเอียด').decode('UTF8'),styleHead);
row1.write(2, ('วันที่รายงาน').decode('UTF8'),styleHead );
row1.write(3, ('หน่วยที่รายงาน').decode('UTF8') ,styleHead);
i=i+1;
for value in objectProject:
row1 = sheet1.row(i) ;
row1.write(0, value.get('risk_management_id') ,styleRowDetail );
row1.write(1, value.get('risk_detail').decode('UTF8'),StyleRowDetailWrap );
#sheet1.write_merge(i, i, 1, 2, value.get('risk_detail').decode('UTF8') , StyleRowDetailWrap );
row1.write(2, value.get('report_date') ,styleDate );
row1.write(3, value.get('report').decode('UTF8') ,styleRowDetail );
i=i+1;
for sub in value.get('response') :
row1 = sheet1.row(i) ;
row1.write(0," " );
text = "(" + sub.get('risk_team').decode('UTF8') + " ) " + sub.get('result').decode('UTF8');
row1.write(1, text ,StyleRowDetailWrap );
i=i+1;
dirTempFile = gettempdir() + _os.sep + str('simpleReport5.xls');
book.save(dirTempFile);
return dirTempFile;
示例14: range
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
sheet.write_merge(i, i, 0, 2, Line_data, style) #以合并单元格形式写入数据,即将数据写入以第1/2/3列合并德单元格内
for i in range(0x00,0xff): # 设置单元格内字体样式
fnt = Font() # 创建一个文本格式,包括字体、字号和颜色样式特性
fnt.name = '微软雅黑' # 设置其字体为微软雅黑, 'SimSun' # 指定“宋体”
fnt.colour_index = i # 设置其字体颜色
fnt.bold = True
style.font = fnt #将赋值好的模式参数导入Style
sheet.write_merge(i,i,3,5,Line_data,style) #以合并单元格形式写入数据,即将数据写入以第4/5/6列合并德单元格内
for i in range(0, 0x53): # 设置单元格下框线样式
borders = Borders()
borders.left = i
borders.right = i
borders.top = i
borders.bottom = i
style.borders = borders #将赋值好的模式参数导入Style
sheet.write_merge(i,i,6,8,Line_data,style) #以合并单元格形式写入数据,即将数据写入以第4/5/6列合并德单元格内
for i in range(6, 80): # 设置单元格下列宽样式
sheet.write(0,i,Line_data,style)
sheet.col(i).width = 0x0d00 + i*50
path_py = "/home/gswewf/jian1.bmp" #读取插入图片以.py运行时路径,images和.py在同一目录下
sheet.insert_bitmap(path_py, 2, 9) #插入一个图片
wbk.save('TestData2.xls') #保存TestData2.xls文件,保存到脚本或exe文件运行的目录下
import xlwt
def set_font(colour_index=2):
示例15: archivo_excel
# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import bottom [as 别名]
def archivo_excel(titulo, archivo_logo = 'unprg.bmp', label_resumen = [], datos_resumen = [], heads = [], color = 0x9ACD32, registros = [], nombre_archivo = 'descargar.xls'):
book = Workbook()
sheet1 = book.add_sheet('Hoja 01')
#estilos de celda titulo
fnt_titulo = Font()
fnt_titulo.name = 'Arial'
fnt_titulo.bold = True
style_titulo = XFStyle()
style_titulo.font = fnt_titulo
#estilos de celda etiqueta resumen
fnt_etiqueta_resumen = Font()
fnt_etiqueta_resumen.name = 'Arial'
fnt_etiqueta_resumen.bold = True
style_etiqueta_resumen = XFStyle()
style_etiqueta_resumen.font = fnt_etiqueta_resumen
#estilos de celda datos resumen
fnt_dato_resumen = Font()
fnt_dato_resumen.name = 'Arial'
style_dato_resumen = XFStyle()
style_dato_resumen.font = fnt_dato_resumen
#estilos de celda heads
fnt_heads = Font()
fnt_heads.name = 'Arial'
fnt_heads.bold = True
borders_heads = Borders()
borders_heads.left = Borders.THIN
borders_heads.right = Borders.THIN
borders_heads.top = Borders.THIN
borders_heads.bottom = Borders.THIN
pattern_heads = Pattern()
pattern_heads.pattern = Pattern.SOLID_PATTERN
pattern_heads.pattern_fore_colour = color
style_heads = XFStyle()
style_heads.font = fnt_heads
style_heads.borders = borders_heads
style_heads.pattern = pattern_heads
#estilos de celda registros
fnt_registros = Font()
fnt_registros.name = 'Arial'
borders_registros = Borders()
borders_registros.left = Borders.THIN
borders_registros.right = Borders.THIN
borders_registros.top = Borders.THIN
borders_registros.bottom = Borders.THIN
style_registros = XFStyle()
style_registros.font = fnt_registros
style_registros.borders = borders_registros
sheet1.insert_bitmap(settings.MEDIA_ROOT + 'archivos_excel/%s' % archivo_logo, 1, 0)
#escribir el titulo
sheet1.write(10,0,titulo, style_titulo)
row = 12
col = 0
#escribir las etiquetas del resumen
for etiqueta in label_resumen:
sheet1.write(row, col, etiqueta, style_etiqueta_resumen)
row+=1
row = 12
col = 1
#escribir los datos del resumen
for dato in datos_resumen:
sheet1.write(row, col, dato, style_dato_resumen)
row+=1
row+=1
col = 0
#escribimos los encabezados
for head in heads:
sheet1.write(row,col,head,style_heads)
col+=1
row+=1
col=1
n = 1
#recorremos la lista y escribimos los datos
for fila in registros:
sheet1.write(row,0,n,style_registros)
for dato in fila:
sheet1.write(row,col,dato,style_registros)
col+=1
col=1
row+=1
n+=1
#.........这里部分代码省略.........