powerpoint package

PowerPoint.Application
PowerPoint.BulletFormat

表示附加到 PowerPoint.ParagraphFormat 的文本的项目符号格式属性。

PowerPoint.ParagraphFormat

表示附加到 PowerPoint.TextRange 的文本的段落格式属性。

PowerPoint.Presentation
PowerPoint.RequestContext

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

PowerPoint.Shape

表示幻灯片中的单个形状。

PowerPoint.ShapeCollection

表示形状的集合。

PowerPoint.ShapeFill

表示形状对象的填充格式。

PowerPoint.ShapeFont

表示形状的 TextRange 对象的字体属性,例如字体名称、字号和颜色。

PowerPoint.ShapeLineFormat

表示形状对象的线条格式。 对于图像和几何形状,线条格式表示形状的边框。

PowerPoint.ShapeScopedCollection

表示形状的集合。

PowerPoint.Slide

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

PowerPoint.SlideCollection

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

PowerPoint.SlideLayout

表示幻灯片的版式。

PowerPoint.SlideLayoutCollection

表示幻灯片母版提供的幻灯片版式的集合。

PowerPoint.SlideMaster

表示幻灯片的幻灯片母版。

PowerPoint.SlideMasterCollection

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

PowerPoint.SlideScopedCollection

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

PowerPoint.Tag

表示幻灯片中的单个标记。

PowerPoint.TagCollection

表示标记的集合。

PowerPoint.TextFrame

表示形状对象的文本框。

PowerPoint.TextRange

包含附加到形状上的文本,以及用于操作文本的属性和方法。

接口

PowerPoint.AddSlideOptions

表示添加新幻灯片时可用的选项。

PowerPoint.InsertSlideOptions

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

PowerPoint.Interfaces.BulletFormatData

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

PowerPoint.Interfaces.BulletFormatLoadOptions

表示附加到 PowerPoint.ParagraphFormat 的文本的项目符号格式属性。

PowerPoint.Interfaces.BulletFormatUpdateData

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

PowerPoint.Interfaces.CollectionLoadOptions

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

PowerPoint.Interfaces.ParagraphFormatData

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

PowerPoint.Interfaces.ParagraphFormatLoadOptions

表示附加到 PowerPoint.TextRange 的文本的段落格式属性。

PowerPoint.Interfaces.ParagraphFormatUpdateData

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

PowerPoint.Interfaces.PresentationData

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

PowerPoint.Interfaces.PresentationLoadOptions
PowerPoint.Interfaces.ShapeCollectionData

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

PowerPoint.Interfaces.ShapeCollectionLoadOptions

表示形状的集合。

PowerPoint.Interfaces.ShapeCollectionUpdateData

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

PowerPoint.Interfaces.ShapeData

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

PowerPoint.Interfaces.ShapeFillData

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

PowerPoint.Interfaces.ShapeFillLoadOptions

表示形状对象的填充格式。

PowerPoint.Interfaces.ShapeFillUpdateData

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

PowerPoint.Interfaces.ShapeFontData

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

PowerPoint.Interfaces.ShapeFontLoadOptions

表示形状的 TextRange 对象的字体属性,例如字体名称、字号和颜色。

PowerPoint.Interfaces.ShapeFontUpdateData

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

PowerPoint.Interfaces.ShapeLineFormatData

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

PowerPoint.Interfaces.ShapeLineFormatLoadOptions

表示形状对象的线条格式。 对于图像和几何形状,线条格式表示形状的边框。

PowerPoint.Interfaces.ShapeLineFormatUpdateData

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

PowerPoint.Interfaces.ShapeLoadOptions

表示幻灯片中的单个形状。

PowerPoint.Interfaces.ShapeScopedCollectionData

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

PowerPoint.Interfaces.ShapeScopedCollectionLoadOptions

表示形状的集合。

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.SlideLayoutCollectionLoadOptions

表示幻灯片母版提供的幻灯片版式的集合。

PowerPoint.Interfaces.SlideLayoutCollectionUpdateData

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

PowerPoint.Interfaces.SlideLayoutData

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

PowerPoint.Interfaces.SlideLayoutLoadOptions

表示幻灯片的版式。

PowerPoint.Interfaces.SlideLoadOptions

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

PowerPoint.Interfaces.SlideMasterCollectionData

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

PowerPoint.Interfaces.SlideMasterCollectionLoadOptions

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

PowerPoint.Interfaces.SlideMasterCollectionUpdateData

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

PowerPoint.Interfaces.SlideMasterData

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

PowerPoint.Interfaces.SlideMasterLoadOptions

表示幻灯片的幻灯片母版。

PowerPoint.Interfaces.SlideScopedCollectionData

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

PowerPoint.Interfaces.SlideScopedCollectionLoadOptions

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

PowerPoint.Interfaces.SlideScopedCollectionUpdateData

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

PowerPoint.Interfaces.TagCollectionData

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

PowerPoint.Interfaces.TagCollectionLoadOptions

表示标记的集合。

PowerPoint.Interfaces.TagCollectionUpdateData

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

PowerPoint.Interfaces.TagData

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

PowerPoint.Interfaces.TagLoadOptions

表示幻灯片中的单个标记。

PowerPoint.Interfaces.TagUpdateData

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

PowerPoint.Interfaces.TextFrameData

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

PowerPoint.Interfaces.TextFrameLoadOptions

表示形状对象的文本框。

PowerPoint.Interfaces.TextFrameUpdateData

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

PowerPoint.Interfaces.TextRangeData

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

PowerPoint.Interfaces.TextRangeLoadOptions

包含附加到形状上的文本,以及用于操作文本的属性和方法。

PowerPoint.Interfaces.TextRangeUpdateData

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

PowerPoint.ShapeAddOptions

表示添加形状时可用的选项。

枚举

PowerPoint.ConnectorType

指定线条形状的连接线类型。

PowerPoint.ErrorCodes
PowerPoint.GeometricShapeType

指定对象的形状类型 GeometricShape

PowerPoint.InsertSlideFormatting

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

PowerPoint.ParagraphHorizontalAlignment

表示 PowerPoint.Shape PowerPoint.TextFrame 的水平对齐方式

PowerPoint.ShapeAutoSize

确定允许的自动调整大小的类型。

PowerPoint.ShapeFillType

指定形状的填充类型。

PowerPoint.ShapeFontUnderlineStyle

应用于字体的下划线类型。

PowerPoint.ShapeLineDashStyle

指定直线的虚线线型。

PowerPoint.ShapeLineStyle

指定线型。

PowerPoint.ShapeType

指定形状的类型。

PowerPoint.TextVerticalAlignment

表示 PowerPoint.Shape PowerPoint.TextFrame 的垂直对齐方式。 如果选择了一个居中选项,则 的内容 TextFrame 将以组的形式水平居中 Shape 。 若要更改文本的水平对齐方式,请参阅 PowerPoint.ParagraphFormatPowerPoint.ParagraphHorizontalAlignment

函数

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 对象模型。

返回