powerpoint package
类
PowerPoint.Application | |
PowerPoint.Presentation | |
PowerPoint.RequestContext |
RequestContext 对象有助于向 PowerPoint 应用程序发出请求。 由于 Office 加载项和 PowerPoint 应用程序在两个不同的进程中运行,因此需要请求上下文才能从外接程序访问 PowerPoint 对象模型。 |
PowerPoint.Shape |
表示幻灯片中的单个形状。 |
PowerPoint.ShapeCollection |
表示形状的集合。 |
PowerPoint.Slide |
表示演示文稿的一张幻灯片。 |
PowerPoint.SlideCollection |
表示演示文稿中的幻灯片集合。 |
PowerPoint.SlideLayout |
表示幻灯片的版式。 |
PowerPoint.SlideLayoutCollection |
表示幻灯片母版提供的幻灯片版式的集合。 |
PowerPoint.SlideMaster |
表示幻灯片的幻灯片母版。 |
PowerPoint.SlideMasterCollection |
表示演示文稿中幻灯片母版的集合。 |
PowerPoint.Tag |
表示幻灯片中的单个标记。 |
PowerPoint.TagCollection |
表示标记的集合。 |
接口
枚举
PowerPoint.ErrorCodes | |
PowerPoint.InsertSlideFormatting |
指定插入幻灯片时的格式设置选项。 |
函数
Power |
创建并打开新演示文稿。 (可选)可以使用 base64 编码的.pptx文件预填充演示文稿。 |
Power |
使用新的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 承诺解决后,将释放在执行过程中自动分配的任何跟踪对象。 |
Power |
使用以前创建的 API 对象的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 承诺解决后,将释放在执行过程中自动分配的任何跟踪对象。 |
Power |
使用以前创建的 API 对象的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 |
函数详细信息
PowerPoint.createPresentation(base64File)
创建并打开新演示文稿。 (可选)可以使用 base64 编码的.pptx文件预填充演示文稿。
export function createPresentation(base64File?: string): Promise<void>;
参数
- base64File
-
string
可选。 base64 编码.pptx文件。 默认值为 null。
返回
Promise<void>
示例
const myFile = <HTMLInputElement>document.getElementById("file");
const reader = new FileReader();
reader.onload = (event) => {
// Remove the metadata before the base64-encoded string.
const startIndex = reader.result.toString().indexOf("base64,");
const copyBase64 = reader.result.toString().substr(startIndex + 7);
PowerPoint.createPresentation(copyBase64);
};
// Read in the file as a data URL so we can parse the base64-encoded string.
reader.readAsDataURL(myFile.files[0]);
PowerPoint.run(batch)
使用新的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 承诺解决后,将释放在执行过程中自动分配的任何跟踪对象。
export function run<T>(batch: (context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>): OfficeExtension.IPromise<T>;
参数
- batch
-
(context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>
一个函数,它接受 RequestContext 并返回承诺 (通常只是“context.sync () ”) 的结果。 上下文参数有助于向 PowerPoint 应用程序发出请求。 由于 Office 加载项和 PowerPoint 应用程序在两个不同的进程中运行,因此需要 RequestContext 才能从外接程序访问 PowerPoint 对象模型。
返回
PowerPoint.run(object, batch)
使用以前创建的 API 对象的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 承诺解决后,将释放在执行过程中自动分配的任何跟踪对象。
export function run<T>(object: OfficeExtension.ClientObject, batch: (context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>): OfficeExtension.IPromise<T>;
参数
- object
- OfficeExtension.ClientObject
以前创建的 API 对象。 批处理将使用与传入对象相同的 RequestContext,这意味着“context.sync () ”将选取应用于该对象的任何更改。
- batch
-
(context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>
一个函数,它接受 RequestContext 并返回承诺 (通常只是“context.sync () ”) 的结果。 上下文参数有助于向 PowerPoint 应用程序发出请求。 由于 Office 加载项和 PowerPoint 应用程序在两个不同的进程中运行,因此需要 RequestContext 才能从外接程序访问 PowerPoint 对象模型。
返回
PowerPoint.run(objects, batch)
使用以前创建的 API 对象的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。
export function run<T>(objects: OfficeExtension.ClientObject[], batch: (context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>): OfficeExtension.IPromise<T>;
参数
- objects
以前创建的 API 对象的数组。 将对数组进行验证,以确保所有对象共享相同的上下文。 批处理将使用此共享的 RequestContext,这意味着“context.sync () ”将选取应用于这些对象的任何更改。
- batch
-
(context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>
一个函数,它接受 RequestContext 并返回承诺 (通常只是“context.sync () ”) 的结果。 上下文参数有助于向 PowerPoint 应用程序发出请求。 由于 Office 加载项和 PowerPoint 应用程序在两个不同的进程中运行,因此需要 RequestContext 才能从外接程序访问 PowerPoint 对象模型。
返回
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈