name property

Font.name property

Gets or sets the name of the font.

get name(): string

Remarks

When getting, returns Font.nameAscii.

When setting, sets Font.nameAscii, Font.nameBi, Font.nameFarEast and Font.nameOther to the specified value.

Examples

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

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

let font = run.font;
font.name = "Courier New";
font.size = 36;
font.highlightColor = "#FFFF00";

doc.firstSection.body.firstParagraph.appendChild(run);
doc.save(base.artifactsDir + "Font.CreateFormattedRun.docx");

Shows how to insert formatted text using DocumentBuilder.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

// Specify font formatting, then add text.
let font = builder.font;
font.size = 16;
font.bold = true;
font.color = "#0000FF";
font.name = "Courier New";
font.underline = aw.Underline.Dash;

builder.write("Hello world!");

See Also