FontFormat
HtmlFixedSaveOptions.FontFormat property
获取或设置ExportFontFormat
用于字体导出。 默认值为Woff.
public ExportFontFormat FontFormat { get; set; }
例子
显示将文档保存为 HTML 时如何仅使用目标计算机的字体。
Document doc = new Document(MyDir + "Bullet points with alternative font.docx");
HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions
{
ExportEmbeddedCss = true,
UseTargetMachineFonts = useTargetMachineFonts,
FontFormat = ExportFontFormat.Ttf,
ExportEmbeddedFonts = false,
};
doc.Save(ArtifactsDir + "HtmlFixedSaveOptions.UsingMachineFonts.html", saveOptions);
string outDocContents = File.ReadAllText(ArtifactsDir + "HtmlFixedSaveOptions.UsingMachineFonts.html");
if (useTargetMachineFonts)
Assert.False(Regex.Match(outDocContents, "@font-face").Success);
else
Assert.True(Regex.Match(outDocContents,
"@font-face { font-family:'Arial'; font-style:normal; font-weight:normal; src:local[(]'☺'[)], " +
"url[(]'HtmlFixedSaveOptions.UsingMachineFonts/font001.ttf'[)] format[(]'truetype'[)]; }").Success);
也可以看看
- enum ExportFontFormat
- class HtmlFixedSaveOptions
- 命名空间 Aspose.Words.Saving
- 部件 Aspose.Words