Presentation API
Use Office.show(iframe) for an iframe that opened a Presentation document. The module identifier is show; the
product name is Presentation.
First complete the distribution, import map, and HTTP server setup in the Editor SDK quickstart.
Open this document type in the office-frame iframe. Use the JavaScript blocks below in order in the same module
script. Write examples change the document, so run them on a sample or copy.
Object model
The root handle is Show.Document. Object types in the current catalog: Slide, Shape, Image, Line, Group,
Chart, Table, TableCell, and Comment.
Every handle method is a round trip to the editor and returns a Promise.
Slides and shapes
import { Office, ShapePreset } from "@thinkfree.dev/tfo-sdk";
const iframe = document.querySelector("#office-frame");
const show = Office.show(iframe);
await show.whenReady();
const doc = show.getDocument();
const slides = await doc.getSlides();
if (!slides.length) throw new Error("Open a presentation with at least one slide.");
const shape = await slides[0].insertShape(ShapePreset.RECT, { x: 100, y: 100, width: 300, height: 120 });
await shape.insertText("Quarterly update");
const added = await doc.insertSlide();
await added.appendSlideNoteText("Speaker notes");
await doc.save();
Shape presets and other shared constants (ShapePreset, LineDash, ShapeZOrder, Chart*) are flat exports.
Presentation-specific constants live in the Show namespace (for example Show.ShapeType, Show.SlideLayoutType).
Narrow shape types
findShapes() and getShapes() return a union of shape kinds. Use the synchronous type guards to narrow without a round
trip:
for (const s of await slides[0].getShapes()) {
if (s.isImage()) console.log("image", await s.getSize());
else if (s.isTable()) console.log("table", await s.getRowCount());
else if (s.isShape()) console.log("shape", await s.getText());
}
Guards available on shape handles: isShape(), isImage(), isLine(), isGroup(), isChart(), isTable().
Errors
A failed operation rejects with SDKError; the editor's structured response is in error.data (error.data.error.code).
See Document tools and error handling for the full error table.
API reference
Every object type available on Presentation handles in the current SDK build has its own reference page, generated
from the SDK type definitions: a method summary table, then each method's TypeScript signature, parameters, and return
value. Every method returns a Promise. Pick an object type below or open it from the sidebar.
Presentation · 10 object types · 586 methods · namespace Show. This reference is generated from the API document artifact (sdk-api-doc.html) produced with the SDK build. Descriptions are the editor's API comments as published. Pin the SDK and Office versions together and regenerate when either changes.
| Object type | Methods | Obtained from |
|---|---|---|
Show.Document | 56 | app.getDocument() |
Show.Slide | 60 | Document.duplicateSlide(), Document.duplicateSlides(), Document.findSlides(), … |
Show.Shape | 117 | Document.findShapes(), Slide.duplicateShape(), Slide.duplicateShapes(), … |
Show.Image | 69 | Slide.insertImage(), Slide.insertWebVideo() |
Show.Line | 70 | - |
Show.Group | 37 | Slide.groupShapes() |
Show.Chart | 50 | Document.findCharts(), Slide.findCharts() |
Show.Table | 56 | Document.findTables(), Slide.findTables(), Slide.insertTable() |
Show.TableCell | 57 | Table.findCells(), Table.getCell(), Table.getCells(), … |
Show.Comment | 14 | Document.findComments(), Slide.findComments(), Slide.getComments(), … |
Constant members are listed on the Show.* page.