Skip to content
SumOfficeSumOfficeSumOffice

Browser surface interface (Browser Surface API)

Embedding the surface: mounting and unmounting it, events for your application, and its current limits.

Starting the surface. $CLI is the path to the processor inside the installed application, defined on the Installation and verification page:

Terminal window
"$CLI" surface --port 0 --doc /absolute/input.docx --save /absolute/output.docx

What the surface exposes on the window. The names start with fastdoc — this is the document engine’s internal name in the code, not a different product: the rename to SumDoc didn’t touch them, because changing the names in the code would break compatibility for anyone who has already embedded the surface. The same applies to the spreadsheet, with the fastsheet prefix.

interface HostConfig { theme?:"light"|"dark"; locale?:string; readOnly?:boolean; cssVariables?:Record<`--fastdoc-${string}`,string>; }
interface Handle { container:HTMLElement; hostConfig:Readonly<HostConfig>; unmount():void; }
interface FastDocSurface { version:"fastdoc.surface-mount.v1"; mount(container:HTMLElement, config?:HostConfig):Handle; unmount():void; }
// window.fastdocSurface: FastDocSurface
type SurfaceEvent =
| {schema:"fastdoc.surface-host-event.v1";type:"ready";documentPath:string;savePath:string;theme:string;locale:string}
| {schema:"fastdoc.surface-host-event.v1";type:"dirty";dirty:boolean}
| {schema:"fastdoc.surface-host-event.v1";type:"saved";dirty:false;path:string;byteCount:number}
| {schema:"fastdoc.surface-host-event.v1";type:"error";operation:"connect"|"save";message:string}
| {schema:"fastdoc.surface-host-event.v1";type:"unmounted"};
window.addEventListener("fastdoc-host-event", e => consume((e as CustomEvent<SurfaceEvent>).detail));
// In WKWebView, events arrive at the fastdocHost handler; in WebView2, via WebMessageReceived

The surface is limited today: mounting and unmounting, reading and editing the first paragraph, saving, finishing, and five events. Arbitrary document structure, selection, and the context menu are not exposed.

Documentation assistant

Answers are assembled from the documentation and may be inaccurate — check the sources.