예제 #1
0
 def add_image2(self,
                bmp_name='',
                x='',
                y='',
                length='',
                title_name='ceshi',
                sheet_name='sheet'):
     if sheet_name not in self.sheets:
         # Create if does not exist
         self.create_sheet(sheet_name)
     tall_style = xlwt.easyxf('font:height 820;')
     self.sheets[sheet_name]['sheet'].row(
         self.sheets[sheet_name]['rows']).set_style(tall_style)
     self.sheets[sheet_name]['sheet'].insert_bitmap('logo.bmp',\
                                                    x,y,0,0,scale_x=0.50,\
                                                    scale_y=0.60)
     if length:
         style = xlwt.XFStyle()  # Create Style
         font = xlwt.Font()
         font.bold = True
         font.height = 0x00FD
         style.font = font
         alignment = xlwt.Alignment()  # Create Alignment
         alignment.horz = xlwt.Alignment.HORZ_CENTER
         # May be: HORZ_GENERAL,HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED,HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED
         alignment.vert = xlwt.Alignment.VERT_CENTER
         # May be: VERT_TOP,VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED
         style.alignment = alignment  # Add Alignment to Style
         self.sheets[sheet_name]['sheet'].write_merge(self.sheets[sheet_name]['rows'],self.sheets[sheet_name]['rows'],\
                                                     1,length-1,\
                                                     title_name,style)
     self.sheets[sheet_name]['rows'] += 1
예제 #2
0
 def add_remark(self, remark_name, length, sheet_name='sheet'):
     if sheet_name not in self.sheets:
         # Create if does not exist
         self.create_sheet(sheet_name)
     style = xlwt.XFStyle()  # Create Style
     font = xlwt.Font()
     font.bold = False
     #font.height = 0x00EB
     font.height = 0x00FD
     style.font = font
     #style.alignment.wrap = xlwt.Alignment.WRAP_AT_RIGHT
     alignment = xlwt.Alignment()  # Create Alignment
     alignment.horz = xlwt.Alignment.HORZ_LEFT
     # May be: HORZ_GENERAL,HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED,HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED
     alignment.vert = xlwt.Alignment.VERT_CENTER
     # May be: VERT_TOP,VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED
     alignment.wrap = xlwt.Alignment.WRAP_AT_RIGHT
     style.alignment = alignment  # Add Alignment to Style
     self.sheets[sheet_name]['sheet'].write_merge(self.sheets[sheet_name]['rows'],self.sheets[sheet_name]['rows'],\
                                                 0,length-1,\
                                                 remark_name,style)
     tall_style = xlwt.easyxf('font:height 820;')
     self.sheets[sheet_name]['sheet'].row(
         self.sheets[sheet_name]['rows']).set_style(tall_style)
     self.sheets[sheet_name]['rows'] += 1
예제 #3
0
    def add_big_head(self,bmp_show='',x='',y='',length='',title_name='ceshi',sheet_name='sheet'):
        if sheet_name not in self.sheets:
            # Create if does not exist
            self.create_sheet(sheet_name)
        tall_style = xlwt.easyxf('font:height 820;')
        self.sheets[sheet_name]['sheet'].row(self.sheets[sheet_name]['rows']).set_style(tall_style)
        if bmp_show:
            self.sheets[sheet_name]['sheet'].insert_bitmap('logo.bmp',\
                                                           x,y,0,0,scale_x=0.33,\
                                                           scale_y=0.60)
            length_start=1
        else:
            length_start=0

        if length:
            style = xlwt.XFStyle() # Create Style
            font = xlwt.Font()
            font.bold = True
            font.height = 0x00FD
            style.font = font
            alignment = xlwt.Alignment() # Create Alignment
            alignment.horz = xlwt.Alignment.HORZ_CENTER 
            # May be: HORZ_GENERAL,HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED,HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED
            alignment.vert = xlwt.Alignment.VERT_CENTER 
            # May be: VERT_TOP,VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED
            style.alignment = alignment # Add Alignment to Style
            self.sheets[sheet_name]['sheet'].write_merge(self.sheets[sheet_name]['rows'],self.sheets[sheet_name]['rows'],\
                                                        length_start,length-1,\
                                                        title_name,style)
        self.sheets[sheet_name]['rows'] += 1
예제 #4
0
 def add_remark(self,remark_name,length,sheet_name='sheet'):
     if sheet_name not in self.sheets:
         # Create if does not exist
         self.create_sheet(sheet_name)
     style = xlwt.XFStyle() # Create Style
     font = xlwt.Font()
     font.bold = False
     #font.height = 0x00EB
     font.height = 0x00FD
     style.font = font
     #style.alignment.wrap = xlwt.Alignment.WRAP_AT_RIGHT
     alignment = xlwt.Alignment() # Create Alignment
     alignment.horz = xlwt.Alignment.HORZ_LEFT
     # May be: HORZ_GENERAL,HORZ_LEFT, HORZ_CENTER, HORZ_RIGHT, HORZ_FILLED, HORZ_JUSTIFIED,HORZ_CENTER_ACROSS_SEL, HORZ_DISTRIBUTED
     alignment.vert = xlwt.Alignment.VERT_CENTER 
     # May be: VERT_TOP,VERT_CENTER, VERT_BOTTOM, VERT_JUSTIFIED, VERT_DISTRIBUTED
     alignment.wrap = xlwt.Alignment.WRAP_AT_RIGHT
     style.alignment = alignment # Add Alignment to Style
     self.sheets[sheet_name]['sheet'].write_merge(self.sheets[sheet_name]['rows'],self.sheets[sheet_name]['rows'],\
                                                 0,length-1,\
                                                 remark_name,style)
     tall_style = xlwt.easyxf('font:height 820;')
     self.sheets[sheet_name]['sheet'].row(self.sheets[sheet_name]['rows']).set_style(tall_style)
     self.sheets[sheet_name]['rows'] += 1