PowerPoint.ShapeCollection class
Représente la collection de formes.
- Extends
Remarques
[ Ensemble d’API : PowerPointApi 1.3 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/get-shapes-by-type.yaml
// Changes the transparency of every geometric shape in the slide.
await PowerPoint.run(async (context) => {
// Get the type of shape for every shape in the collection.
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
shapes.load("type");
await context.sync();
// Change the shape transparency to be halfway transparent.
shapes.items.forEach((shape) => {
if (shape.type === PowerPoint.ShapeType.geometricShape) {
shape.fill.transparency = 0.5;
}
});
await context.sync();
});
Propriétés
| context | Contexte de requête associé à l’objet . Cela connecte le processus du complément au processus de l’application hôte Office. |
| items | Obtient l’élément enfant chargé dans cette collection de sites. |
Méthodes
| add |
Ajoute une forme géométrique à la diapositive. Renvoie un |
| add |
Ajoute une forme géométrique à la diapositive. Renvoie un |
| add |
Créez un groupe de formes pour plusieurs formes. |
| add |
Ajoute une ligne à la diapositive. Renvoie un |
| add |
Ajoute une ligne à la diapositive. Renvoie un |
| add |
Ajoute un tableau à la diapositive. Renvoie un |
| add |
Ajoute une zone de texte à la diapositive avec le texte fourni comme contenu. Renvoie un |
| get |
Obtient le nombre de formes dans la collection. |
| get |
Obtient une forme à l’aide de son ID unique. Une erreur est générée si la forme n’existe pas. |
| get |
Obtient une forme à l’aide de son index de base zéro dans la collection. Une erreur est générée si l’index est hors limites. |
| get |
Obtient une forme à l’aide de son ID unique. Si une telle forme n’existe pas, un objet avec une |
| load(options) | Files d’attente de la commande pour charger les propriétés de l’objet spécifié. Vous devez contacter |
| load(property |
Files d’attente de la commande pour charger les propriétés de l’objet spécifié. Vous devez contacter |
| load(property |
Files d’attente de la commande pour charger les propriétés de l’objet spécifié. Vous devez contacter |
| toJSON() | Remplace la méthode JavaScript |
Détails de la propriété
context
Contexte de requête associé à l’objet . Cela connecte le processus du complément au processus de l’application hôte Office.
context: RequestContext;
Valeur de propriété
items
Obtient l’élément enfant chargé dans cette collection de sites.
readonly items: PowerPoint.Shape[];
Valeur de propriété
Détails de la méthode
addGeometricShape(geometricShapeType, options)
Ajoute une forme géométrique à la diapositive. Renvoie un Shape objet qui représente la nouvelle forme.
addGeometricShape(geometricShapeType: PowerPoint.GeometricShapeType, options?: PowerPoint.ShapeAddOptions): PowerPoint.Shape;
Paramètres
- geometricShapeType
- PowerPoint.GeometricShapeType
Spécifie le type de la forme géométrique. Pour plus d’informations , voir PowerPoint.GeometricShapeType .
- options
- PowerPoint.ShapeAddOptions
Paramètre facultatif pour spécifier les options supplémentaires telles que la position de la forme.
Retours
Forme nouvellement insérée.
Remarques
[ Ensemble d’API : PowerPointApi 1.4 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/shapes.yaml
// This function gets the collection of shapes on the first slide,
// and adds a hexagon shape to the collection, while specifying its
// location and size. Then it names the shape.
await PowerPoint.run(async (context) => {
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
const shapeOptions: PowerPoint.ShapeAddOptions = {
left: 100,
top: 100,
height: 150,
width: 150,
};
const hexagon: PowerPoint.Shape = shapes.addGeometricShape(PowerPoint.GeometricShapeType.hexagon, shapeOptions);
hexagon.name = "Hexagon";
await context.sync();
});
addGeometricShape(geometricShapeType, options)
Ajoute une forme géométrique à la diapositive. Renvoie un Shape objet qui représente la nouvelle forme.
addGeometricShape(geometricShapeType: "LineInverse" | "Triangle" | "RightTriangle" | "Rectangle" | "Diamond" | "Parallelogram" | "Trapezoid" | "NonIsoscelesTrapezoid" | "Pentagon" | "Hexagon" | "Heptagon" | "Octagon" | "Decagon" | "Dodecagon" | "Star4" | "Star5" | "Star6" | "Star7" | "Star8" | "Star10" | "Star12" | "Star16" | "Star24" | "Star32" | "RoundRectangle" | "Round1Rectangle" | "Round2SameRectangle" | "Round2DiagonalRectangle" | "SnipRoundRectangle" | "Snip1Rectangle" | "Snip2SameRectangle" | "Snip2DiagonalRectangle" | "Plaque" | "Ellipse" | "Teardrop" | "HomePlate" | "Chevron" | "PieWedge" | "Pie" | "BlockArc" | "Donut" | "NoSmoking" | "RightArrow" | "LeftArrow" | "UpArrow" | "DownArrow" | "StripedRightArrow" | "NotchedRightArrow" | "BentUpArrow" | "LeftRightArrow" | "UpDownArrow" | "LeftUpArrow" | "LeftRightUpArrow" | "QuadArrow" | "LeftArrowCallout" | "RightArrowCallout" | "UpArrowCallout" | "DownArrowCallout" | "LeftRightArrowCallout" | "UpDownArrowCallout" | "QuadArrowCallout" | "BentArrow" | "UturnArrow" | "CircularArrow" | "LeftCircularArrow" | "LeftRightCircularArrow" | "CurvedRightArrow" | "CurvedLeftArrow" | "CurvedUpArrow" | "CurvedDownArrow" | "SwooshArrow" | "Cube" | "Can" | "LightningBolt" | "Heart" | "Sun" | "Moon" | "SmileyFace" | "IrregularSeal1" | "IrregularSeal2" | "FoldedCorner" | "Bevel" | "Frame" | "HalfFrame" | "Corner" | "DiagonalStripe" | "Chord" | "Arc" | "LeftBracket" | "RightBracket" | "LeftBrace" | "RightBrace" | "BracketPair" | "BracePair" | "Callout1" | "Callout2" | "Callout3" | "AccentCallout1" | "AccentCallout2" | "AccentCallout3" | "BorderCallout1" | "BorderCallout2" | "BorderCallout3" | "AccentBorderCallout1" | "AccentBorderCallout2" | "AccentBorderCallout3" | "WedgeRectCallout" | "WedgeRRectCallout" | "WedgeEllipseCallout" | "CloudCallout" | "Cloud" | "Ribbon" | "Ribbon2" | "EllipseRibbon" | "EllipseRibbon2" | "LeftRightRibbon" | "VerticalScroll" | "HorizontalScroll" | "Wave" | "DoubleWave" | "Plus" | "FlowChartProcess" | "FlowChartDecision" | "FlowChartInputOutput" | "FlowChartPredefinedProcess" | "FlowChartInternalStorage" | "FlowChartDocument" | "FlowChartMultidocument" | "FlowChartTerminator" | "FlowChartPreparation" | "FlowChartManualInput" | "FlowChartManualOperation" | "FlowChartConnector" | "FlowChartPunchedCard" | "FlowChartPunchedTape" | "FlowChartSummingJunction" | "FlowChartOr" | "FlowChartCollate" | "FlowChartSort" | "FlowChartExtract" | "FlowChartMerge" | "FlowChartOfflineStorage" | "FlowChartOnlineStorage" | "FlowChartMagneticTape" | "FlowChartMagneticDisk" | "FlowChartMagneticDrum" | "FlowChartDisplay" | "FlowChartDelay" | "FlowChartAlternateProcess" | "FlowChartOffpageConnector" | "ActionButtonBlank" | "ActionButtonHome" | "ActionButtonHelp" | "ActionButtonInformation" | "ActionButtonForwardNext" | "ActionButtonBackPrevious" | "ActionButtonEnd" | "ActionButtonBeginning" | "ActionButtonReturn" | "ActionButtonDocument" | "ActionButtonSound" | "ActionButtonMovie" | "Gear6" | "Gear9" | "Funnel" | "MathPlus" | "MathMinus" | "MathMultiply" | "MathDivide" | "MathEqual" | "MathNotEqual" | "CornerTabs" | "SquareTabs" | "PlaqueTabs" | "ChartX" | "ChartStar" | "ChartPlus", options?: PowerPoint.ShapeAddOptions): PowerPoint.Shape;
Paramètres
- geometricShapeType
-
"LineInverse" | "Triangle" | "RightTriangle" | "Rectangle" | "Diamond" | "Parallelogram" | "Trapezoid" | "NonIsoscelesTrapezoid" | "Pentagon" | "Hexagon" | "Heptagon" | "Octagon" | "Decagon" | "Dodecagon" | "Star4" | "Star5" | "Star6" | "Star7" | "Star8" | "Star10" | "Star12" | "Star16" | "Star24" | "Star32" | "RoundRectangle" | "Round1Rectangle" | "Round2SameRectangle" | "Round2DiagonalRectangle" | "SnipRoundRectangle" | "Snip1Rectangle" | "Snip2SameRectangle" | "Snip2DiagonalRectangle" | "Plaque" | "Ellipse" | "Teardrop" | "HomePlate" | "Chevron" | "PieWedge" | "Pie" | "BlockArc" | "Donut" | "NoSmoking" | "RightArrow" | "LeftArrow" | "UpArrow" | "DownArrow" | "StripedRightArrow" | "NotchedRightArrow" | "BentUpArrow" | "LeftRightArrow" | "UpDownArrow" | "LeftUpArrow" | "LeftRightUpArrow" | "QuadArrow" | "LeftArrowCallout" | "RightArrowCallout" | "UpArrowCallout" | "DownArrowCallout" | "LeftRightArrowCallout" | "UpDownArrowCallout" | "QuadArrowCallout" | "BentArrow" | "UturnArrow" | "CircularArrow" | "LeftCircularArrow" | "LeftRightCircularArrow" | "CurvedRightArrow" | "CurvedLeftArrow" | "CurvedUpArrow" | "CurvedDownArrow" | "SwooshArrow" | "Cube" | "Can" | "LightningBolt" | "Heart" | "Sun" | "Moon" | "SmileyFace" | "IrregularSeal1" | "IrregularSeal2" | "FoldedCorner" | "Bevel" | "Frame" | "HalfFrame" | "Corner" | "DiagonalStripe" | "Chord" | "Arc" | "LeftBracket" | "RightBracket" | "LeftBrace" | "RightBrace" | "BracketPair" | "BracePair" | "Callout1" | "Callout2" | "Callout3" | "AccentCallout1" | "AccentCallout2" | "AccentCallout3" | "BorderCallout1" | "BorderCallout2" | "BorderCallout3" | "AccentBorderCallout1" | "AccentBorderCallout2" | "AccentBorderCallout3" | "WedgeRectCallout" | "WedgeRRectCallout" | "WedgeEllipseCallout" | "CloudCallout" | "Cloud" | "Ribbon" | "Ribbon2" | "EllipseRibbon" | "EllipseRibbon2" | "LeftRightRibbon" | "VerticalScroll" | "HorizontalScroll" | "Wave" | "DoubleWave" | "Plus" | "FlowChartProcess" | "FlowChartDecision" | "FlowChartInputOutput" | "FlowChartPredefinedProcess" | "FlowChartInternalStorage" | "FlowChartDocument" | "FlowChartMultidocument" | "FlowChartTerminator" | "FlowChartPreparation" | "FlowChartManualInput" | "FlowChartManualOperation" | "FlowChartConnector" | "FlowChartPunchedCard" | "FlowChartPunchedTape" | "FlowChartSummingJunction" | "FlowChartOr" | "FlowChartCollate" | "FlowChartSort" | "FlowChartExtract" | "FlowChartMerge" | "FlowChartOfflineStorage" | "FlowChartOnlineStorage" | "FlowChartMagneticTape" | "FlowChartMagneticDisk" | "FlowChartMagneticDrum" | "FlowChartDisplay" | "FlowChartDelay" | "FlowChartAlternateProcess" | "FlowChartOffpageConnector" | "ActionButtonBlank" | "ActionButtonHome" | "ActionButtonHelp" | "ActionButtonInformation" | "ActionButtonForwardNext" | "ActionButtonBackPrevious" | "ActionButtonEnd" | "ActionButtonBeginning" | "ActionButtonReturn" | "ActionButtonDocument" | "ActionButtonSound" | "ActionButtonMovie" | "Gear6" | "Gear9" | "Funnel" | "MathPlus" | "MathMinus" | "MathMultiply" | "MathDivide" | "MathEqual" | "MathNotEqual" | "CornerTabs" | "SquareTabs" | "PlaqueTabs" | "ChartX" | "ChartStar" | "ChartPlus"
Spécifie le type de la forme géométrique. Pour plus d’informations , voir PowerPoint.GeometricShapeType .
- options
- PowerPoint.ShapeAddOptions
Paramètre facultatif pour spécifier les options supplémentaires telles que la position de la forme.
Retours
Forme nouvellement insérée.
Remarques
addGroup(values)
Créez un groupe de formes pour plusieurs formes.
addGroup(values: Array<string | Shape>): PowerPoint.Shape;
Paramètres
- values
-
Array<string | PowerPoint.Shape>
Tableau d’ID de forme ou d’objets Shape .
Retours
Objet Shape qui représente le groupe de formes. Utilisez la Shape.group propriété pour accéder à l’objet ShapeGroup du groupe.
Remarques
[ Ensemble d’API : PowerPointApi 1.8 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/group-ungroup-shapes.yaml
await PowerPoint.run(async (context) => {
// Groups the geometric shapes on the current slide.
// Get the shapes on the current slide.
context.presentation.load("slides");
const slide: PowerPoint.Slide = context.presentation.getSelectedSlides().getItemAt(0);
slide.load("shapes/items/type,shapes/items/id");
await context.sync();
const shapes: PowerPoint.ShapeCollection = slide.shapes;
const shapesToGroup = shapes.items.filter((item) => item.type === PowerPoint.ShapeType.geometricShape);
if (shapesToGroup.length === 0) {
console.warn("No shapes on the current slide, so nothing to group.");
return;
}
// Group the geometric shapes.
console.log(`Number of shapes to group: ${shapesToGroup.length}`);
const group = shapes.addGroup(shapesToGroup);
group.load("id");
await context.sync();
console.log(`Grouped shapes. Group ID: ${group.id}`);
});
addLine(connectorType, options)
Ajoute une ligne à la diapositive. Renvoie un Shape objet qui représente la nouvelle ligne.
addLine(connectorType?: PowerPoint.ConnectorType, options?: PowerPoint.ShapeAddOptions): PowerPoint.Shape;
Paramètres
- connectorType
- PowerPoint.ConnectorType
Spécifie le type de connecteur de la ligne. S’il n’est pas fourni, straight le type de connecteur est utilisé. Pour plus d’informations , voir PowerPoint.ConnectorType .
- options
- PowerPoint.ShapeAddOptions
Paramètre facultatif pour spécifier les options supplémentaires telles que la position de l’objet shape qui contient la ligne.
Retours
Forme nouvellement insérée.
Remarques
[ Ensemble d’API : PowerPointApi 1.4 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/shapes.yaml
// This function gets the collection of shapes on the first slide,
// and adds a line to the collection, while specifying its
// start and end points. Then it names the shape.
await PowerPoint.run(async (context) => {
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
// For a line, left and top are the coordinates of the start point,
// while height and width are the coordinates of the end point.
const line: PowerPoint.Shape = shapes.addLine(PowerPoint.ConnectorType.straight, {
left: 400,
top: 200,
height: 20,
width: 150,
});
line.name = "StraightLine";
await context.sync();
});
addLine(connectorType, options)
Ajoute une ligne à la diapositive. Renvoie un Shape objet qui représente la nouvelle ligne.
addLine(connectorType?: "Straight" | "Elbow" | "Curve", options?: PowerPoint.ShapeAddOptions): PowerPoint.Shape;
Paramètres
- connectorType
-
"Straight" | "Elbow" | "Curve"
Spécifie le type de connecteur de la ligne. S’il n’est pas fourni, straight le type de connecteur est utilisé. Pour plus d’informations , voir PowerPoint.ConnectorType .
- options
- PowerPoint.ShapeAddOptions
Paramètre facultatif pour spécifier les options supplémentaires telles que la position de l’objet shape qui contient la ligne.
Retours
Forme nouvellement insérée.
Remarques
addTable(rowCount, columnCount, options)
Ajoute un tableau à la diapositive. Renvoie un Shape objet qui représente la nouvelle table. Utilisez la Shape.table propriété pour obtenir l’objet Table de la forme.
addTable(rowCount: number, columnCount: number, options?: PowerPoint.TableAddOptions): PowerPoint.Shape;
Paramètres
- rowCount
-
number
Nombre de lignes dans la table. Doit être égal ou supérieur à 1.
- columnCount
-
number
Nombre de colonnes dans la table. Doit être égal ou supérieur à 1.
- options
- PowerPoint.TableAddOptions
Fournit des options décrivant la nouvelle table.
Retours
Forme nouvellement insérée.
Remarques
[ Ensemble d’API : PowerPointApi 1.8 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Adds a basic table.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedSlides().getItemAt(0).shapes;
// Add a simple table, specifying the row and column count.
shapes.addTable(3, 4);
await context.sync();
});
addTextBox(text, options)
Ajoute une zone de texte à la diapositive avec le texte fourni comme contenu. Renvoie un Shape objet qui représente la nouvelle zone de texte.
addTextBox(text: string, options?: PowerPoint.ShapeAddOptions): PowerPoint.Shape;
Paramètres
- text
-
string
Spécifie le texte qui sera affiché dans la zone de texte créée.
- options
- PowerPoint.ShapeAddOptions
Paramètre facultatif pour spécifier les options supplémentaires telles que la position de la zone de texte.
Retours
Forme nouvellement insérée.
Remarques
[ Ensemble d’API : PowerPointApi 1.4 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/shapes.yaml
// This function gets the collection of shapes on the first slide,
// and adds a text box to the collection, while specifying its text,
// location, and size. Then it names the text box.
await PowerPoint.run(async (context) => {
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
const textbox: PowerPoint.Shape = shapes.addTextBox("Hello!", {
left: 100,
top: 300,
height: 300,
width: 450,
});
textbox.name = "Textbox";
return context.sync();
});
getCount()
Obtient le nombre de formes dans la collection.
getCount(): OfficeExtension.ClientResult<number>;
Retours
OfficeExtension.ClientResult<number>
Nombre de formes dans la collection.
Remarques
[ Ensemble d’API : PowerPointApi 1.3 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/add-modify-tables.yaml
// Gets the table from a shape.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
if (shapeCount.value > 0) {
const shape = shapes.getItemAt(0);
shape.load("type");
await context.sync();
// The shape type can indicate whether the shape is a table.
const isTable = shape.type === PowerPoint.ShapeType.table;
if (isTable) {
// Get the Table object for the Shape which is a table.
const table = shape.getTable();
table.load();
await context.sync();
// Get the Table row and column count.
console.log("Table RowCount: " + table.rowCount + " and columnCount: " + table.columnCount);
} else console.log("Selected shape isn't table.");
} else console.log("No shape selected.");
});
getItem(key)
Obtient une forme à l’aide de son ID unique. Une erreur est générée si la forme n’existe pas.
getItem(key: string): PowerPoint.Shape;
Paramètres
- key
-
string
ID de la forme.
Retours
Forme avec l’ID unique. Si une telle forme n’existe pas, une erreur est générée.
Remarques
getItemAt(index)
Obtient une forme à l’aide de son index de base zéro dans la collection. Une erreur est générée si l’index est hors limites.
getItemAt(index: number): PowerPoint.Shape;
Paramètres
- index
-
number
Index de la forme dans la collection.
Retours
Forme à l’index donné. Une erreur est générée si l’index est hors limites.
Remarques
[ Ensemble d’API : PowerPointApi 1.3 ]
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/tags/tags.yaml
await PowerPoint.run(async function (context) {
const slide: PowerPoint.Slide = context.presentation.slides.getItemAt(0);
const shape: PowerPoint.Shape = slide.shapes.getItemAt(0);
shape.tags.add("MOUNTAIN", "Denali");
await context.sync();
const myShapeTag: PowerPoint.Tag = shape.tags.getItem("MOUNTAIN");
myShapeTag.load("key, value");
await context.sync();
console.log("Added key " + JSON.stringify(myShapeTag.key) + " with value " + JSON.stringify(myShapeTag.value));
});
getItemOrNullObject(id)
Obtient une forme à l’aide de son ID unique. Si une telle forme n’existe pas, un objet avec une isNullObject propriété définie sur true est retourné. Pour plus d’informations, consultez *Méthodes et propriétés OrNullObject.
getItemOrNullObject(id: string): PowerPoint.Shape;
Paramètres
- id
-
string
ID de la forme.
Retours
Forme avec l’ID unique. Si une telle forme n’existe pas, un objet avec une isNullObject propriété définie sur true est retourné.
Remarques
load(options)
Files d’attente de la commande pour charger les propriétés de l’objet spécifié. Vous devez contacter context.sync() avant de lire les propriétés.
load(options?: PowerPoint.Interfaces.ShapeCollectionLoadOptions & PowerPoint.Interfaces.CollectionLoadOptions): PowerPoint.ShapeCollection;
Paramètres
- options
-
PowerPoint.Interfaces.ShapeCollectionLoadOptions & PowerPoint.Interfaces.CollectionLoadOptions
Fournit des options pour les propriétés de l’objet à charger.
Retours
load(propertyNames)
Files d’attente de la commande pour charger les propriétés de l’objet spécifié. Vous devez contacter context.sync() avant de lire les propriétés.
load(propertyNames?: string | string[]): PowerPoint.ShapeCollection;
Paramètres
- propertyNames
-
string | string[]
Chaîne délimitée par des virgules ou tableau de chaînes qui spécifient les propriétés à charger.
Retours
Exemples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/get-shapes-by-type.yaml
// Changes the transparency of every geometric shape in the slide.
await PowerPoint.run(async (context) => {
// Get the type of shape for every shape in the collection.
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
shapes.load("type");
await context.sync();
// Change the shape transparency to be halfway transparent.
shapes.items.forEach((shape) => {
if (shape.type === PowerPoint.ShapeType.geometricShape) {
shape.fill.transparency = 0.5;
}
});
await context.sync();
});
load(propertyNamesAndPaths)
Files d’attente de la commande pour charger les propriétés de l’objet spécifié. Vous devez contacter context.sync() avant de lire les propriétés.
load(propertyNamesAndPaths?: OfficeExtension.LoadOption): PowerPoint.ShapeCollection;
Paramètres
- propertyNamesAndPaths
- OfficeExtension.LoadOption
propertyNamesAndPaths.select est une chaîne délimitée par des virgules qui spécifie les propriétés à charger, et propertyNamesAndPaths.expand est une chaîne délimitée par des virgules qui spécifie les propriétés de navigation à charger.
Retours
toJSON()
Remplace la méthode JavaScript toJSON() afin de fournir une sortie plus utile lorsqu’un objet API est passé à JSON.stringify(). (JSON.stringify, à son tour, appelle la toJSON méthode de l’objet qui lui est passé.) Alors que l’objet d’origine PowerPoint.ShapeCollection est un objet API, la toJSON méthode renvoie un objet JavaScript brut (typé en tant PowerPoint.Interfaces.ShapeCollectionDataque ) qui contient un tableau « items » avec des copies superficielles de toutes les propriétés chargées à partir des éléments de la collection.
toJSON(): PowerPoint.Interfaces.ShapeCollectionData;