主题
Font (属性)
返回一个 Font 对象,它代表指定对象的字体。
示例
python
#此示例判断单元格 A1 的字体名称是否为 Arial,并通知用户
def test():
Application.Range("A1").Select()
# Determine if the font name for selected cell is Arial.
if Application.Range("A1").Font.Name == "Arial":
print("The font name for this cell is 'Arial'")
else:
print("The font name for this cell is not 'Arial'")
python
#此示例将A1单元格字体加粗
def test():
Range("A1").Font.Bold = True