当前位置: 首页>>代码示例>>Python>>正文


Python Borders.right方法代码示例

本文整理汇总了Python中xlwt.Borders.right方法的典型用法代码示例。如果您正苦于以下问题:Python Borders.right方法的具体用法?Python Borders.right怎么用?Python Borders.right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xlwt.Borders的用法示例。


在下文中一共展示了Borders.right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: css2excel

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:aniquez,项目名称:mod,代码行数:36,代码来源:excelib.py

示例2: getDefualtStyle

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:Eddy-W,项目名称:scripts,代码行数:32,代码来源:savedata2xls_new.py

示例3: excel_style

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:juacompe,项目名称:beryl,代码行数:20,代码来源:views.py

示例4: __init__

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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()
开发者ID:Bolton-and-Menk-GIS,项目名称:LittleRiver-Tools,代码行数:56,代码来源:excel.py

示例5: setupFormat

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:ambonilla,项目名称:Convertidor-de-csv-a-xls-para-BNCR,代码行数:19,代码来源:CsvReader.py

示例6: estiloCeldasSeparadas

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:santicalvo,项目名称:traductorpy,代码行数:20,代码来源:init_extract.py

示例7: __init__

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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'  # 设置数字格式
开发者ID:giveme168,项目名称:braavos,代码行数:22,代码来源:excel.py

示例8: transCellData_summary

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:Eddy-W,项目名称:scripts,代码行数:22,代码来源:savedata2xls_new.py

示例9: creaHojaDeTraduccion

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
开发者ID:santicalvo,项目名称:traductorpy,代码行数:25,代码来源:init_extract.py

示例10: detail_budget

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
#.........这里部分代码省略.........
开发者ID:arpitb827,项目名称:Salary-notifications,代码行数:103,代码来源:budget.py

示例11: account_budget

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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
#.........这里部分代码省略.........
开发者ID:arpitb827,项目名称:Salary-notifications,代码行数:103,代码来源:budget.py

示例12: exportToExcel

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [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   );
#.........这里部分代码省略.........
开发者ID:tongpa,项目名称:bantakCom,代码行数:103,代码来源:risktoexcel.py

示例13: generate_report

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [as 别名]
def generate_report(root, filename, attend_staff, absent_staff, meeting_direct, record_staff, reports, issues):
    book = Workbook(encoding='utf-8')
    sheet1 = book.add_sheet('Fota Security Knox Week Report')
    line_counter = 0

    today = datetime.date.today().strftime('%Y/%m/%d')
    # header
    head_str = [
        'Meeting Name', 'SW 3 Group Part 5 Fota/ Security/Knox/Encription TG WeekReport',
        '', '',
        'Meeting Date', today,
        'Meeting Address', '8F Meeting Room',
        '', '',
        'Attend Staff', attend_staff,
        'Absent Staff', absent_staff,
        '', '',
        'Meeting Direct', meeting_direct,
        'Record Staff', record_staff,
    ]

    for i in range(len(head_str) / 2):
        sheet1.row(i).write(0, head_str[2 * i])
        sheet1.row(i).write(1, head_str[2 * i + 1])
    line_counter = len(head_str) / 2 + 1

    # font bold
    font = Font()
    font.bold = True
    # pattern yellow
    pattern_yellow = Pattern()
    pattern_yellow.pattern = Pattern.SOLID_PATTERN
    pattern_yellow.pattern_fore_colour = 0x0D  # yellow
    # pattern gray
    pattern_gray = Pattern()
    pattern_gray.pattern = Pattern.SOLID_PATTERN
    pattern_gray.pattern_fore_colour = 0x17  # gray
    # borders thin
    borders = Borders()
    borders.left = Borders.THIN
    borders.right = Borders.THIN
    borders.top = Borders.THIN
    borders.bottom = Borders.THIN
    # alignment horizontal center
    alig_hc = Alignment()
    # alig.horizontal = Alignment.HORZ_CENTER #no effect, why? fuck!!!
    alig_hc.horz = Alignment.HORZ_CENTER

    # title style
    style_title = XFStyle()
    style_title.font = font
    style_title.pattern = pattern_yellow
    style_title.alignment = alig_hc
    sheet1.write_merge(
        line_counter, line_counter, 0, 3, 'summary', style_title)

    line_counter += 1

    # table header style
    sytle_tb_header = XFStyle()
    sytle_tb_header.font = font
    sytle_tb_header.pattern = pattern_gray
    sytle_tb_header.borders = borders
    sytle_tb_header.alignment = alig_hc

    sheet1.row(line_counter).write(0, 'Member', sytle_tb_header)
    sheet1.row(line_counter).write(1, 'Week Jobs', sytle_tb_header)
    sheet1.row(line_counter).write(2, 'Risk', sytle_tb_header)
    sheet1.row(line_counter).write(3, 'Next Week Plan', sytle_tb_header)
    line_counter += 1

    # content

    # for i in range(line_counter,11+line_counter):
    i = line_counter
    for report in reports:
        # alignment
        alig = Alignment()
        alig.horz = Alignment.HORZ_CENTER
        alig.vert = Alignment.VERT_CENTER
        alig.wrap = 1

        # alignment2
        alig2 = Alignment()
        alig2.vert = Alignment.VERT_CENTER
        alig2.wrap = 1

        # borders
        borders = Borders()
        borders.left = Borders.THIN
        borders.right = Borders.THIN
        borders.top = Borders.THIN
        borders.bottom = Borders.THIN
        # colors
        pattern = Pattern()
        pattern.pattern = Pattern.SOLID_PATTERN
        pattern.pattern_fore_colour = 0x2F

        style_content = XFStyle()
        style_content.alignment = alig
        style_content.borders = borders
#.........这里部分代码省略.........
开发者ID:benshen,项目名称:wrg,代码行数:103,代码来源:mk_report.py

示例14: Font

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [as 别名]
from datetime import date
from xlwt import Workbook, XFStyle, Borders, Pattern, Font

fnt = Font()
fnt.name = 'Arial'

borders = Borders()
borders.left = Borders.THICK
borders.right = Borders.THICK
borders.top = Borders.THICK
borders.bottom = Borders.THICK

pattern = Pattern()
pattern.pattern = Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = 0x0A

style = XFStyle()
style.num_format_str='YYYY-MM-DD'
style.font = fnt
style.borders = borders
style.pattern = pattern

book = Workbook()
sheet = book.add_sheet('A Date')
sheet.write(1,1,date(2009,3,18),style)

book.save('date.xls')
开发者ID:DivyaShanmugam,项目名称:pydanny-event-notes,代码行数:29,代码来源:xfstyle_format.py

示例15: archivo_excel1

# 需要导入模块: from xlwt import Borders [as 别名]
# 或者: from xlwt.Borders import right [as 别名]
def archivo_excel1(titulo, archivo_logo = 'unprg.bmp', label_resumen = [], datos_resumen = [], heads = [], color = 0x9ACD32, registros = [], nombre_archivo = 'descargar.xls'):
    import StringIO
    output = StringIO.StringIO()
    from django.http import HttpResponse
    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
#.........这里部分代码省略.........
开发者ID:lizceth,项目名称:Mysite,代码行数:103,代码来源:reportes.py


注:本文中的xlwt.Borders.right方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。