powerpointem-all
Version:
PowerPoint'em All: Export selected frames from Figma to PowerPoint with local agent server.
19 lines (16 loc) • 606 B
JavaScript
Office.onReady(() => {
const btn = document.getElementById('btn');
btn.onclick = async () => {
const dataUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGNgYAAAAAMAASsJTYQAAAAASUVORK5CYII=';
const res = await fetch(dataUrl);
const blob = await res.blob();
const arrayBuffer = await blob.arrayBuffer();
Office.context.document.setSelectedDataAsync(arrayBuffer, {
coercionType: Office.CoercionType.Image
}, (asyncResult) => {
if (asyncResult.status !== Office.AsyncResultStatus.Succeeded) {
console.error(asyncResult.error);
}
});
};
});