PresentationFactory

PresentationFactory 类

允许通过 COM 接口创建演示文稿

public class PresentationFactory : IPresentationFactory

构造函数

名称描述
PresentationFactory()默认构造函数。

属性

名称描述
static Instance { get; }PresentationFactory 静态实例。只读 PresentationFactory

方法

名称描述
CreatePresentation()创建新的演示文稿。
CreatePresentation(ILoadOptions)使用额外的加载选项创建新的演示文稿
GetPresentationInfo(Stream)从流创建 PresentationInfo 对象并将演示文稿绑定到该对象。获取指定流中演示文稿的信息。
GetPresentationInfo(string)从文件创建 PresentationInfo 对象并将演示文稿绑定到该对象。
GetPresentationText(Stream, TextExtractionArrangingMode)从幻灯片检索原始文本
GetPresentationText(string, TextExtractionArrangingMode)从幻灯片检索原始文本
GetPresentationText(Stream, TextExtractionArrangingMode, ILoadOptions)从幻灯片检索原始文本
ReadPresentation(byte[])从数组读取已有演示文稿
ReadPresentation(Stream)从流读取已有演示文稿
ReadPresentation(string)从文件读取已有演示文稿
ReadPresentation(byte[], ILoadOptions)使用额外的加载选项从数组读取已有演示文稿
ReadPresentation(Stream, ILoadOptions)使用额外的加载选项从流读取已有演示文稿
ReadPresentation(string, ILoadOptions)使用额外的加载选项从流读取已有演示文稿

示例

以下示例演示如何检查演示文稿格式。

[C#]
IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo("pres.pptx");
Console.WriteLine(info.LoadFormat); // PPTX
IPresentationInfo info2 = PresentationFactory.Instance.GetPresentationInfo("pres.ppt");
Console.WriteLine(info2.LoadFormat); // PPT
IPresentationInfo info3 = PresentationFactory.Instance.GetPresentationInfo("pres.odp");
Console.WriteLine(info3.LoadFormat); // ODP

以下示例演示如何获取演示文稿的属性。

[C#]
IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo("pres.pptx");
IDocumentProperties props = info.ReadDocumentProperties();
Console.WriteLine(props.CreatedTime);
Console.WriteLine(props.Subject);
Console.WriteLine(props.Title);
// …

以下示例演示如何更新演示文稿的属性。

[C#]
IPresentationInfo info = PresentationFactory.Instance.GetPresentationInfo("pres.pptx");
IDocumentProperties props = info.ReadDocumentProperties();
props.Title = "My title";
info.UpdateDocumentProperties(props);

另请参见