Python xlwt.Borders() Examples
The following are 5
code examples of xlwt.Borders().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
xlwt
, or try the search function
.
Example #1
Source File: AnalysisData.py From UniversityRecruitment-sSurvey with Apache License 2.0 | 7 votes |
def set_style(name, height, bold=False): style = xlwt.XFStyle() # 初始化样式 font = xlwt.Font() # 为样式创建字体 font.name = name # 'Times New Roman' font.bold = bold font.color_index = 4 font.height = height # borders= xlwt.Borders() # borders.left= 6 # borders.right= 6 # borders.top= 6 # borders.bottom= 6 style.font = font # style.borders = borders return style
Example #2
Source File: db_excel.py From nlp_learning with MIT License | 7 votes |
def set_style(name, height, bold=False): # 设置字体 style = xlwt.XFStyle() font = xlwt.Font() font.name = name font.bold = bold font.color_index = 4 font.height = height style.font = font # 设置边框 borders = xlwt.Borders() # 细实线:1,小粗实线:2,细虚线:3,中细虚线:4,大粗实线:5,双线:6,细点虚线:7 # 大粗虚线:8,细点划线:9,粗点划线:10,细双点划线:11,粗双点划线:12,斜点划线:13 borders.left = 1 borders.right = 1 borders.top = 1 borders.bottom = 1 style.borders = borders return style # 写Excel
Example #3
Source File: base_xls.py From lpts with GNU General Public License v2.0 | 7 votes |
def borders(line=0x00, colour=0x40): ''' @param line: cell线条格式 参照borders_map @param colour: 线条颜色 查看_colour_map_text ''' bds = xlwt.Borders() bds.left = line bds.right = line bds.top = line bds.bottom = line bds.diag = line bds.left_colour = colour bds.right_colour = colour bds.top_colour = colour bds.bottom_colour = colour bds.diag_colour = colour return bds
Example #4
Source File: mytools.py From chat with MIT License | 7 votes |
def set_excel_style(name, height, bold=False): """Set excel style. """ style = xlwt.XFStyle() # 初始化样式 font = xlwt.Font() # 为样式创建字体 font.name = name # 例如'Times New Roman' font.bold = bold font.color_index = 4 font.height = height if bold: borders = xlwt.Borders() borders.left = 6 borders.right = 6 borders.top = 6 borders.bottom = 6 style.borders = borders style.font = font return style
Example #5
Source File: GetPageDetail.py From CNKI-download with MIT License | 6 votes |
def set_style(self): ''' 设置excel样式 ''' self.sheet.col(1).width = 256 * 30 self.sheet.col(2).width = 256 * 15 self.sheet.col(3).width = 256 * 20 self.sheet.col(4).width = 256 * 20 self.sheet.col(5).width = 256 * 60 self.sheet.col(6).width = 256 * 15 self.sheet.col(9).width = 256 * 15 self.sheet.row(0).height_mismatch = True self.sheet.row(0).height = 20 * 20 self.basic_style = xlwt.XFStyle() al = xlwt.Alignment() # 垂直对齐 al.horz = al.HORZ_CENTER # 水平对齐 al.vert = al.VERT_CENTER # 换行 al.wrap = al.WRAP_AT_RIGHT # 设置边框 borders = xlwt.Borders() borders.left = 6 borders.right = 6 borders.top = 6 borders.bottom = 6 self.basic_style.alignment = al self.basic_style.borders = borders