Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Admin] Publish #2068

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ remarks: >-
// start and end points. Then it names the shape.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.slides.getItemAt(0).shapes;
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 = shapes.addLine(PowerPoint.ConnectorType.straight,
const line: PowerPoint.Shape = shapes.addLine(PowerPoint.ConnectorType.straight,
{
left: 400,
top: 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ remarks: >-
// location and size. Then it names the shape.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.slides.getItemAt(0).shapes;
const hexagon = shapes.addGeometricShape(PowerPoint.GeometricShapeType.hexagon,
{
left: 100,
top: 100,
height: 150,
width: 150
});
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ remarks: >-

await PowerPoint.run(async function(context) {
// Get the ID of the first selected slide.
const presentation = context.presentation;
const selected = presentation.getSelectedSlides().getItemAt(0);
const presentation: PowerPoint.Presentation = context.presentation;
const selected: PowerPoint.Slide = presentation.getSelectedSlides().getItemAt(0);
selected.load("id");
await context.sync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ remarks: >-

await PowerPoint.run(async function(context) {
// Get the ID of the first selected slide.
const presentation = context.presentation;
const selected = presentation.getSelectedSlides().getItemAt(0);
const presentation: PowerPoint.Presentation = context.presentation;
const selected: PowerPoint.Slide = presentation.getSelectedSlides().getItemAt(0);
selected.load("id");
await context.sync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ remarks: >-

await PowerPoint.run(async function(context) {
// Get the ID of the first selected slide.
const presentation = context.presentation;
const selected = presentation.getSelectedSlides().getItemAt(0);
const presentation: PowerPoint.Presentation = context.presentation;
const selected: PowerPoint.Slide = presentation.getSelectedSlides().getItemAt(0);
selected.load("id");
await context.sync();

Expand Down Expand Up @@ -150,7 +150,7 @@ methods:
// Arranges the selected shapes in a line from left to right.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -178,7 +178,7 @@ methods:

await PowerPoint.run(async (context) => {
let finalTable = "";
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
await context.sync();
finalTable += "<br>getSelectedShapes.getCount returned:<b>" + shapeCount.value + "</b><br>";
Expand All @@ -203,15 +203,15 @@ methods:
await PowerPoint.run(async (context) => {
context.presentation.load("slides");
await context.sync();
const slides = context.presentation.getSelectedSlides();
const slides: PowerPoint.SlideScopedCollection = context.presentation.getSelectedSlides();
const slideCount = slides.getCount();
slides.load("items");
await context.sync();
savedSlideSelection = [];
slides.items.map((slide) => {
savedSlideSelection.push(slide.id);
});
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -258,15 +258,15 @@ methods:
const allSlidesCount = context.presentation.slides.getCount();
context.presentation.slides.load("items");
await context.sync();
let allSlideItems = context.presentation.slides.items;
let allSlideItems: PowerPoint.Slide[] = context.presentation.slides.items;
allSlideItems.map((slide, index) => {
allSlidesList[slide.id] = `Slide ${index + 1}`;
});

if ($("#id-check-usenative").is(":checked")) {
context.presentation.load("tags");
}
const slides = context.presentation.getSelectedSlides();
const slides: PowerPoint.SlideScopedCollection = context.presentation.getSelectedSlides();
const slideCount = slides.getCount();
slides.load("items");
await context.sync();
Expand All @@ -291,7 +291,7 @@ methods:
let finalTable = "";
context.presentation.load("slides");
await context.sync();
const slides = context.presentation.getSelectedSlides();
const slides: PowerPoint.SlideScopedCollection = context.presentation.getSelectedSlides();
const slideCount = slides.getCount();
await context.sync();
finalTable += "<br>getSelectedSlides.getCount returned:<b>" + slideCount.value + "</b><br>";
Expand Down Expand Up @@ -340,7 +340,7 @@ methods:
// Gets the selected text range and prints data about the range on the task pane.

await PowerPoint.run(async (context) => {
const textRange = context.presentation.getSelectedTextRange();
const textRange: PowerPoint.TextRange = context.presentation.getSelectedTextRange();
try {
await context.sync();
} catch (error) {
Expand Down Expand Up @@ -379,9 +379,9 @@ methods:
// Sets the range selection to the range that was saved previously.

await PowerPoint.run(async (context) => {
const slide1 = context.presentation.slides.getItem(savedTextSlideSelection[0]);
const shape1 = slide1.shapes.getItem(savedTextShapeSelection[0]);
const textRange = shape1.textFrame.textRange.getSubstring(savedTextTextRangeStart, savedTextTextRangeLength);
const slide1: PowerPoint.Slide = context.presentation.slides.getItem(savedTextSlideSelection[0]);
const shape1: PowerPoint.Shape = slide1.shapes.getItem(savedTextShapeSelection[0]);
const textRange: PowerPoint.TextRange = shape1.textFrame.textRange.getSubstring(savedTextTextRangeStart, savedTextTextRangeLength);
textRange.setSelected();
await context.sync();
});
Expand Down Expand Up @@ -429,8 +429,8 @@ methods:

await PowerPoint.run(async function(context) {
// Get the ID of the first selected slide.
const presentation = context.presentation;
const selected = presentation.getSelectedSlides().getItemAt(0);
const presentation: PowerPoint.Presentation = context.presentation;
const selected: PowerPoint.Slide = presentation.getSelectedSlides().getItemAt(0);
selected.load("id");
await context.sync();

Expand Down Expand Up @@ -563,9 +563,9 @@ methods:
await PowerPoint.run(async (context) => {
context.presentation.load("slides");
await context.sync();
const slide2 = context.presentation.slides.getItemAt(1);
const slide4 = context.presentation.slides.getItemAt(3);
const slide5 = context.presentation.slides.getItemAt(4);
const slide2: PowerPoint.Slide = context.presentation.slides.getItemAt(1);
const slide4: PowerPoint.Slide = context.presentation.slides.getItemAt(3);
const slide5: PowerPoint.Slide = context.presentation.slides.getItemAt(4);
slide2.load("id");
slide4.load("id");
slide5.load("id");
Expand Down
47 changes: 39 additions & 8 deletions docs/docs-ref-autogen/powerpoint/powerpoint/powerpoint.shape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ remarks: >-

await PowerPoint.run(async (context) => {
// Get the type of shape for every shape in the collection.
const shapes = context.presentation.slides.getItemAt(0).shapes;
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
shapes.load("type");
await context.sync();

Expand Down Expand Up @@ -88,7 +88,7 @@ properties:
// Changes the selected shapes fill color to red.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -128,7 +128,7 @@ properties:
// Arranges the selected shapes in a line from left to right.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -188,7 +188,7 @@ properties:
// Arranges the selected shapes in a line from left to right.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -284,7 +284,7 @@ properties:
// Arranges the selected shapes in a line from left to right.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -333,7 +333,7 @@ properties:

await PowerPoint.run(async (context) => {
// Get the type of shape for every shape in the collection.
const shapes = context.presentation.slides.getItemAt(0).shapes;
const shapes: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
shapes.load("type");
await context.sync();

Expand Down Expand Up @@ -378,7 +378,7 @@ properties:
// Arranges the selected shapes in a line from left to right.

await PowerPoint.run(async (context) => {
const shapes = context.presentation.getSelectedShapes();
const shapes: PowerPoint.ShapeScopedCollection = context.presentation.getSelectedShapes();
const shapeCount = shapes.getCount();
shapes.load("items");
await context.sync();
Expand Down Expand Up @@ -411,7 +411,38 @@ methods:
package: powerpoint!
fullName: delete()
summary: Deletes the shape from the shape collection. Does nothing if the shape does not exist.
remarks: '\[ [API set: PowerPointApi 1.3](/javascript/api/requirement-sets/powerpoint/powerpoint-api-requirement-sets) \]'
remarks: >-
\[ [API set: PowerPointApi 1.3](/javascript/api/requirement-sets/powerpoint/powerpoint-api-requirement-sets) \]


#### Examples


```TypeScript

// 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 then iterates through them, deleting each one.

await PowerPoint.run(async (context) => {
const slide: PowerPoint.Slide = context.presentation.slides.getItemAt(0);
const shapes: PowerPoint.ShapeCollection = slide.shapes;

// Load all the shapes in the collection without loading their properties.
shapes.load("items/$none");

await context.sync();

shapes.items.forEach((shape) => shape.delete());

await context.sync();
});

```
isPreview: false
isDeprecated: false
syntax:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,40 @@ uid: 'powerpoint!PowerPoint.ShapeAddOptions:interface'
package: powerpoint!
fullName: PowerPoint.ShapeAddOptions
summary: Represents the available options when adding shapes.
remarks: '\[ [API set: PowerPointApi 1.4](/javascript/api/requirement-sets/powerpoint/powerpoint-api-requirement-sets) \]'
remarks: >-
\[ [API set: PowerPointApi 1.4](/javascript/api/requirement-sets/powerpoint/powerpoint-api-requirement-sets) \]


#### Examples


```TypeScript

// 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();
});

```
isPreview: false
isDeprecated: false
type: interface
Expand Down
Loading