name property

Font.name property

Gets or sets the name of the font.

@property
def name(self) -> str:
    ...

@name.setter
def name(self, value: str):
    ...

Remarks

When getting, returns Font.name_ascii.

When setting, sets Font.name_ascii, Font.name_bi, Font.name_far_east and Font.name_other to the specified value.

Examples

Shows how to insert formatted text using DocumentBuilder.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

# Specify font formatting, then add text.
font = builder.font
font.size = 16
font.bold = True
font.color = drawing.Color.blue
font.name = "Courier New"
font.underline = aw.Underline.DASH

builder.write("Hello world!")

Shows how to format a run of text using its font property.

doc = aw.Document()
run = aw.Run(doc, "Hello world!")

font = run.font
font.name = "Courier New"
font.size = 36
font.highlight_color = drawing.Color.yellow

doc.first_section.body.first_paragraph.append_child(run)
doc.save(ARTIFACTS_DIR + "Font.create_formatted_run.docx")

See Also