powerpoint package

PowerPoint.Application
PowerPoint.Presentation
PowerPoint.RequestContext

RequestContext 对象有助于向 PowerPoint 应用程序发出请求。 由于 Office 加载项和 PowerPoint 应用程序在两个不同的进程中运行,因此需要请求上下文才能从外接程序访问 PowerPoint 对象模型。

PowerPoint.Slide

表示演示文稿的一张幻灯片。

PowerPoint.SlideCollection

表示演示文稿中的幻灯片集合。

接口

PowerPoint.InsertSlideOptions

表示插入幻灯片时可用的选项。

PowerPoint.Interfaces.BulletFormatData

一个接口,用于描述通过调用 bulletFormat.toJSON()返回的数据。

PowerPoint.Interfaces.BulletFormatUpdateData

用于更新 BulletFormat 对象上的数据的接口,用于 在 中使用 bulletFormat.set({ ... })

PowerPoint.Interfaces.CollectionLoadOptions

提供仅加载集合的一部分成员的属性的方法。

PowerPoint.Interfaces.ParagraphFormatData

一个接口,用于描述通过调用 paragraphFormat.toJSON()返回的数据。

PowerPoint.Interfaces.ParagraphFormatUpdateData

用于更新 ParagraphFormat 对象上的数据的接口,可在 中使用 paragraphFormat.set({ ... })

PowerPoint.Interfaces.PresentationData

一个接口,用于描述通过调用 presentation.toJSON()返回的数据。

PowerPoint.Interfaces.PresentationLoadOptions
PowerPoint.Interfaces.ShapeCollectionData

一个接口,用于描述通过调用 shapeCollection.toJSON()返回的数据。

PowerPoint.Interfaces.ShapeCollectionUpdateData

用于更新 ShapeCollection 对象上的数据的接口,用于 在 中使用 shapeCollection.set({ ... })

PowerPoint.Interfaces.ShapeData

一个接口,用于描述通过调用 shape.toJSON()返回的数据。

PowerPoint.Interfaces.ShapeFillData

一个接口,用于描述通过调用 shapeFill.toJSON()返回的数据。

PowerPoint.Interfaces.ShapeFillUpdateData

用于更新 ShapeFill 对象上的数据的接口,用于 在 中使用 shapeFill.set({ ... })

PowerPoint.Interfaces.ShapeFontData

一个接口,用于描述通过调用 shapeFont.toJSON()返回的数据。

PowerPoint.Interfaces.ShapeFontUpdateData

用于更新 ShapeFont 对象上的数据的接口,可在 中使用 shapeFont.set({ ... })

PowerPoint.Interfaces.ShapeLineFormatData

一个接口,用于描述通过调用 shapeLineFormat.toJSON()返回的数据。

PowerPoint.Interfaces.ShapeLineFormatUpdateData

用于更新 ShapeLineFormat 对象上的数据的接口,用于 在 中使用 shapeLineFormat.set({ ... })

PowerPoint.Interfaces.ShapeScopedCollectionData

一个接口,用于描述通过调用 shapeScopedCollection.toJSON()返回的数据。

PowerPoint.Interfaces.ShapeScopedCollectionUpdateData

用于更新 ShapeScopedCollection 对象上的数据的接口,在 中使用 shapeScopedCollection.set({ ... })

PowerPoint.Interfaces.ShapeUpdateData

用于更新 Shape 对象上的数据的接口,用于 在 中使用 shape.set({ ... })

PowerPoint.Interfaces.SlideCollectionData

一个接口,用于描述通过调用 slideCollection.toJSON()返回的数据。

PowerPoint.Interfaces.SlideCollectionLoadOptions

表示演示文稿中的幻灯片集合。

PowerPoint.Interfaces.SlideCollectionUpdateData

用于更新 SlideCollection 对象上的数据的接口,可在 中使用 slideCollection.set({ ... })

PowerPoint.Interfaces.SlideData

一个接口,用于描述通过调用 slide.toJSON()返回的数据。

PowerPoint.Interfaces.SlideLayoutCollectionData

一个接口,用于描述通过调用 slideLayoutCollection.toJSON()返回的数据。

PowerPoint.Interfaces.SlideLayoutCollectionUpdateData

用于更新 SlideLayoutCollection 对象上的数据的接口,在 中使用 slideLayoutCollection.set({ ... })

PowerPoint.Interfaces.SlideLayoutData

一个接口,用于描述通过调用 slideLayout.toJSON()返回的数据。

PowerPoint.Interfaces.SlideLoadOptions

表示演示文稿的一张幻灯片。

PowerPoint.Interfaces.SlideMasterCollectionData

一个接口,用于描述通过调用 slideMasterCollection.toJSON()返回的数据。

PowerPoint.Interfaces.SlideMasterCollectionUpdateData

用于更新 SlideMasterCollection 对象上的数据的接口,在 中使用 slideMasterCollection.set({ ... })

PowerPoint.Interfaces.SlideMasterData

一个接口,用于描述通过调用 slideMaster.toJSON()返回的数据。

PowerPoint.Interfaces.SlideScopedCollectionData

一个接口,用于描述通过调用 slideScopedCollection.toJSON()返回的数据。

PowerPoint.Interfaces.SlideScopedCollectionLoadOptions

表示演示文稿中的幻灯片集合。

PowerPoint.Interfaces.SlideScopedCollectionUpdateData

用于更新 SlideScopedCollection 对象上的数据的接口,可在 中使用 slideScopedCollection.set({ ... })

PowerPoint.Interfaces.TagCollectionData

一个接口,用于描述通过调用 tagCollection.toJSON()返回的数据。

PowerPoint.Interfaces.TagCollectionUpdateData

用于更新 TagCollection 对象上的数据的接口,在 中使用 tagCollection.set({ ... })

PowerPoint.Interfaces.TagData

一个接口,用于描述通过调用 tag.toJSON()返回的数据。

PowerPoint.Interfaces.TagUpdateData

用于更新 Tag 对象上的数据的接口,用于 在 中使用 tag.set({ ... })

PowerPoint.Interfaces.TextFrameData

一个接口,用于描述通过调用 textFrame.toJSON()返回的数据。

PowerPoint.Interfaces.TextFrameUpdateData

用于更新 TextFrame 对象上的数据的接口,用于 在 中使用 textFrame.set({ ... })

PowerPoint.Interfaces.TextRangeData

一个接口,用于描述通过调用 textRange.toJSON()返回的数据。

PowerPoint.Interfaces.TextRangeUpdateData

用于更新 TextRange 对象上的数据的接口,在 中使用 textRange.set({ ... })

枚举

PowerPoint.ErrorCodes
PowerPoint.InsertSlideFormatting

指定插入幻灯片时的格式设置选项。

函数

PowerPoint.createPresentation(base64File)

创建并打开新演示文稿。 (可选)可以使用 base64 编码的.pptx文件预填充演示文稿。

[ API 集:PowerPointApi 1.1 ]

PowerPoint.run(batch)

使用新的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 承诺解决后,将释放在执行过程中自动分配的任何跟踪对象。

PowerPoint.run(object, batch)

使用以前创建的 API 对象的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。 承诺解决后,将释放在执行过程中自动分配的任何跟踪对象。

PowerPoint.run(objects, batch)

使用以前创建的 API 对象的 RequestContext 执行对 PowerPoint 对象模型执行操作的批处理脚本。

函数详细信息

PowerPoint.createPresentation(base64File)

创建并打开新演示文稿。 (可选)可以使用 base64 编码的.pptx文件预填充演示文稿。

[ API 集:PowerPointApi 1.1 ]

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

OfficeExtension.ClientObject[]

以前创建的 API 对象的数组。 将对数组进行验证,以确保所有对象共享相同的上下文。 批处理将使用此共享的 RequestContext,这意味着“context.sync () ”将选取应用于这些对象的任何更改。

batch

(context: PowerPoint.RequestContext) => OfficeExtension.IPromise<T>

一个函数,它接受 RequestContext 并返回承诺 (通常只是“context.sync () ”) 的结果。 上下文参数有助于向 PowerPoint 应用程序发出请求。 由于 Office 加载项和 PowerPoint 应用程序在两个不同的进程中运行,因此需要 RequestContext 才能从外接程序访问 PowerPoint 对象模型。

返回