DocumentLevelFontSources

LoadOptions.DocumentLevelFontSources 属性

指定演示文稿使用的外部字体源。这些字体在演示文稿的整个生命周期内可用,并且不会与其他演示文稿共享

public IFontSources DocumentLevelFontSources { get; set; }

示例

以下示例演示如何指定在 PowerPoint 演示文稿中使用的自定义字体。

[C#]
byte[] memoryFont1 = File.ReadAllBytes("customfonts\\CustomFont1.ttf");
byte[] memoryFont2 = File.ReadAllBytes("customfonts\\CustomFont2.ttf");
LoadOptions loadOptions = new LoadOptions();
loadOptions.DocumentLevelFontSources.FontFolders = new string[] { "assets\\fonts", "global\\fonts" };
loadOptions.DocumentLevelFontSources.MemoryFonts = new byte[][] { memoryFont1, memoryFont2 };
using (IPresentation presentation = new Presentation("MyPresentation.pptx", loadOptions))
{
    //操作演示文稿
    //CustomFont1、CustomFont2 以及 assets\fonts 和 global\fonts 文件夹及其子文件夹中的字体可用于演示文稿
}

另请参阅