Microsoft 365 and Office | Development | Other
Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm working on a PowerPoint web add-in using Office.js, and I'm trying to change the fill color of selected shapes in a slide. I wrote the following function to change the color, but it's not working as expected. The SVG icon is coming as an image and hence, I'm not able to change the color of the SVG icon.
async function setFillColor(color) { await PowerPoint.run(async (context) => { const selectedShapes = context.presentation.getSelectedShapes(); selectedShapes.load("items"); await context.sync(); await selectedShapes.items.forEach(async (shape) => { if (color != "") shape.fill.setSolidColor(color); else shape.fill.clear(); }); }); }