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


Python xlwt.Font方法代码示例

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


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

示例1: set_style

# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Font [as 别名]
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 
开发者ID:Maicius,项目名称:UniversityRecruitment-sSurvey,代码行数:21,代码来源:AnalysisData.py

示例2: set_excel_style

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

示例3: set_style

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

示例4: export2xls

# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Font [as 别名]
def export2xls(self):
        import xlwt
        font0 = xlwt.Font()
        font0.bold = True
        font0.height = 300
        print((font0.height))

        style0 = xlwt.XFStyle()
        style0.font = font0

        style1 = xlwt.XFStyle()
        style1.num_format_str = 'D-MMM-YY'

        wb = xlwt.Workbook()
        ws = wb.add_sheet('A Test Sheet')

        ws.write(0, 0, 'Test', style0)
        ws.write(2, 0, 1)
        ws.write(2, 1, 1)
        ws.write(2, 2, xlwt.Formula("A3+B3"))

        wb.save('datasheet.xls')
        os.system("gnumeric datasheet.xls") 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:25,代码来源:pump.py

示例5: create_simple_xls

# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Font [as 别名]
def create_simple_xls(self, **kw):
        font0 = xlwt.Font()
        font0.name = 'Times New Roman'
        font0.colour_index = 2
        font0.bold = True

        style0 = xlwt.XFStyle()
        style0.font = font0

        style1 = xlwt.XFStyle()
        style1.num_format_str = 'D-MMM-YY'

        wb = xlwt.Workbook(**kw)
        ws = wb.add_sheet('A Test Sheet')

        ws.write(0, 0, 'Test', style0)
        ws.write(1, 0, datetime(2010, 12, 5), style1)
        ws.write(2, 0, 1)
        ws.write(2, 1, 1)
        ws.write(2, 2, xlwt.Formula("A3+B3"))
        return wb, ws 
开发者ID:alexfeng,项目名称:InternationalizationScript-iOS,代码行数:23,代码来源:test_simple.py

示例6: build_result

# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Font [as 别名]
def build_result(self, coupon_descr_list):
        stk_wb = xlwt.Workbook()
        myfont = xlwt.Font()
        mystyle = xlwt.XFStyle()
        mystyle.font = myfont
        sheet_name = str(date.today())
        sheet = stk_wb.add_sheet(sheet_name, cell_overwrite_ok=True)

        for index, item in enumerate(coupon_descr_list):
            self._write_decision_data(item, index*5, sheet)
            self._write_selected_data(item, index*5, sheet)

        stk_wb.save('../output/funda_rotation_{}'.format(sheet_name) + '.xls') 
开发者ID:licxcx,项目名称:stockbot,代码行数:15,代码来源:funda_rotation.py

示例7: SankeyExport

# 需要导入模块: import xlwt [as 别名]
# 或者: from xlwt import Font [as 别名]
def SankeyExport(self,Year, Path, Element): # Export data for given year in excel format for the D3.js Circular Sankey method
        """ Exports MFAsystem to xls Template for the Circular Sankey method."""
        
        TimeIndex = Year - self.Time_Start
        
        myfont = xlwt.Font()
        myfont.bold = True
        mystyle = xlwt.XFStyle()
        mystyle.font = myfont
        
        Result_workbook  = xlwt.Workbook(encoding = 'ascii') 
        Result_worksheet = Result_workbook.add_sheet('Nodes') 
        Result_worksheet.write(0, 0, label = 'Name', style = mystyle)
        Result_worksheet.write(0, 1, label = 'Color', style = mystyle)
        Result_worksheet.write(0, 2, label = 'Orientation', style = mystyle)
        Result_worksheet.write(0, 3, label = 'Width', style = mystyle)
        Result_worksheet.write(0, 4, label = 'Height', style = mystyle)
        Result_worksheet.write(0, 5, label = 'x_position', style = mystyle)
        Result_worksheet.write(0, 6, label = 'y_position', style = mystyle)
        
        for m in range(0,len(self.ProcessList)): 
            if self.ProcessList[m].Graphical is None:
                raise ValueError('Graphical properties of process number {foo} are not set. No export to Sankey possible, as position of process on canvas etc. needs is not specified.'.format(foo = m))
            Result_worksheet.write(m +1, 0, label = self.ProcessList[m].Graphical['Name'])
            Result_worksheet.write(m +1, 1, label = self.ProcessList[m].Graphical['Color'])
            Result_worksheet.write(m +1, 2, label = self.ProcessList[m].Graphical['Angle'])
            Result_worksheet.write(m +1, 3, label = self.ProcessList[m].Graphical['Width'])
            Result_worksheet.write(m +1, 4, label = self.ProcessList[m].Graphical['Height'])
            Result_worksheet.write(m +1, 5, label = self.ProcessList[m].Graphical['xPos'])
            Result_worksheet.write(m +1, 6, label = self.ProcessList[m].Graphical['yPos'])
            
        Result_worksheet = Result_workbook.add_sheet('Flows') 
        Result_worksheet.write(0, 0, label = 'StartNode', style = mystyle)
        Result_worksheet.write(0, 1, label = 'EndNode', style = mystyle)
        Result_worksheet.write(0, 2, label = 'Value', style = mystyle)
        Result_worksheet.write(0, 3, label = 'Color', style = mystyle)
        
        for key in self.FlowDict:
            Result_worksheet.write(m +1, 0, label = self.FlowDict[key].P_Start)
            Result_worksheet.write(m +1, 1, label = self.FlowDict[key].P_End)
            Result_worksheet.write(m +1, 2, label = float(self.Flow_Sum_By_Element(key)[TimeIndex,Element]))
            Result_worksheet.write(m +1, 3, label = self.FlowDict[key].Color)
            
        Result_workbook.save(Path + self.Name + '_' + str(TimeIndex) + '_' + str(Element) + '_Sankey.xls') 
开发者ID:IndEcol,项目名称:ODYM,代码行数:46,代码来源:ODYM_Classes.py


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