Name

Font.Name property

获取或设置字体的名称。

public string Name { get; set; }

评论

获取时返回NameAscii

设置时,设置NameAsciiNameBiNameFarEastNameOther到指定值。

例子

展示如何使用字体属性来格式化文本。

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

Aspose.Words.Font font = run.Font;
font.Name = "Courier New";
font.Size = 36;
font.HighlightColor = Color.Yellow;

doc.FirstSection.Body.FirstParagraph.AppendChild(run);
doc.Save(ArtifactsDir + "Font.CreateFormattedRun.docx");

展示如何使用 DocumentBuilder 插入格式化文本。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// 指定字体格式,然后添加文本。
Aspose.Words.Font font = builder.Font;
font.Size = 16;
font.Bold = true;
font.Color = Color.Blue;
font.Name = "Courier New";
font.Underline = Underline.Dash;

builder.Write("Hello world!");

也可以看看