Docs / Viewers / DOCX Viewer
DOCX Viewer
Svelte 5 port of the Extend UI docx-viewer. Rendering runs on the client through the docx engine wrapper (docx-preview); the thumbnail sidebar is virtualized.
Differences from upstream
- Upstream exports only
DocxViewerPreview; every upstream export is available here. - Exported as both
DocxViewerand the upstream nameDocxViewerPreview;classNameandclassare both accepted. - Pages render with docx-preview instead of
@extend-ai/react-docx(React-only): comments, tracked changes, and the outline/section anchors are not shown. - The thumbnail sidebar lists page numbers with text excerpts instead of canvas page images, and stays inline instead of collapsing into an overlay on narrow widths.
defaultZoomtakes the same values (default 50). The fit modes are resolved from the first page;"automatic"fits the width but never enlarges past 100%.- docx-preview builds the DOM for every page. Pages away from the viewport skip layout and
paint through
content-visibility: auto, instead of upstream's windowed page rendering. - The page number is editable like upstream; the Previous and Next page buttons are a port addition.
- Hyperlinks keep only
http,https,mailto,tel, and#targets; any other target is removed, so the link shows as plain text. Picture sources keep only embeddeddata:imageandblob:URLs. Scripts, frames, embedded objects, and event-handler attributes in the rendered document are stripped. toolbarActionsis a Svelte snippet instead of a React node.- Legacy
.docfiles are accepted by the upload input, but docx-preview cannot render them; convert them to DOCX.