PresentationFactory

PresentationFactory class

通过COM接口创建演示文稿

public class PresentationFactory : IPresentationFactory

构造函数

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

属性

名称描述
static Instance { get; }演示文稿工厂静态实例。 只读 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);

另请参阅