Reputation: 157
I try to change a text in a shape on a master slide with code:
PowerPoint.run(function(context) {
var masterSlideShape = context.presentation.slideMasters.getItemAt(0).shapes.getItemAt(5);
masterSlideShape .textFrame.textRange.text = 'Some text';
return context.sync();
});
This works fine with desktop PowerPoint. But when it comes to web version, changes are not applied immediately. They are applied only after I refresh a page.
When I work with slides which are not master, everything is updated online.
No console errors
Any ideas?
Upvotes: 0
Views: 61
Reputation: 49455
Try to use the await
keyword for async
operations:
// This sample creates a rectangle positioned 100 points from the top and left sides
// of the slide and is 150x150 points. The shape is put on the first slide.
await PowerPoint.run(async (context) => {
const shapes = context.presentation.slides.getItemAt(0).shapes;
const rectangle = shapes.addGeometricShape(PowerPoint.GeometricShapeType.rectangle);
rectangle.left = 100;
rectangle.top = 100;
rectangle.height = 150;
rectangle.width = 150;
rectangle.name = "Square";
await context.sync();
});
Upvotes: 0