Python: openpyxl change font to bold

后端 未结 2 2017
青春惊慌失措
青春惊慌失措 2021-01-02 02:08

I\'m using Python version 3.6 and the latest version of the openxlpy module (v2.4.8) on Windows.

I want to change certain font to bold in a cell, but I don\'t want a

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 02:51

    Answers post title but not ops specific question.

    from openpyxl.workbook import Workbook
    from openpyxl.styles import Font
    wb = Workbook()
    ws = wb.active
    ws['B3'] = "Hello"
    ws['B3'].font = Font(bold=True)
    wb.save("BoldDemo.xlsx")
    

提交回复
热议问题