8

Times New Roman のフォントと 16 のフォント サイズでコンテンツを作成する必要があります。Python スクリプトを使用して作成するにはどうすればよいですか?

私のサンプルスクリプト

import xlwt
workbook = xlwt.Workbook(encoding = 'ascii')
worksheet = workbook.add_sheet('My Worksheet')
font = xlwt.Font() # Create the Font
font.name = 'Times New Roman'
style = xlwt.XFStyle() # Create the Style
style.font = font # Apply the Font to the Style
worksheet.write(0, 0, label = 'Unformatted value')
worksheet.write(1, 0, label = 'Formatted value') # Apply the Style to the Cell
workbook.save('fontxl.xls')
4

4 に答える 4

1

コメントはあなたがそうしていると言っていますが、実際にはあなたが定義したスタイルを適用していません! 呼び出しでキーワードを
使用します。stylewrite()

worksheet.write(1, 0, label = 'Formatted value', style = style) # Apply the Style
于 2013-05-20T11:19:02.513 に答える