Which API for which job

Choose between the React and Vue review hooks and the Office.js-shaped editing API, then find the exact symbol for each common task.

The library has two ways to change a document. Each one fits a different host. Choose the path first, then use the symbol for your task.

Which API for which job

JobUse
Build a review UI in the browserThe React or Vue adapter hooks, plus the review hooks and DocxEditorReview from @docx-editor.dev/pro/react or @docx-editor.dev/pro/vue.
Edit in a headless, server, or agent pipelineThe editing API in @docx-editor.dev/editor-api, which follows the Office.js object model.
TaskBrowser host (React or Vue)Headless, server, or agent
Comment on found texteditor.findMatches, editor.selectMatch, then useReview().commentbody.search, then Range.insertComment
Reply to a threaduseReview().reply(item, text)Comment.reply(text)
Record a tracked replacementSuggesting mode, then editor.exec({ type: 'replaceMatch', match, text })document.changeTrackingMode = 'TrackMineOnly', then Range.insertText(text, 'Replace')
Propose an AI rewrite as tracked changesThe same code through DocxEditor.createBrowser from @docx-editor.dev/editor-api/browserprepareRewrite from @docx-editor.dev/editor-api/agent
Accept or reject a changeuseReview().accept(item) or useReview().reject(item)Revision.accept() or Revision.reject()
Open or reveal a change without scrollinguseReview().setActive(key, { reveal: false })Not applicable: no viewport
Highlight rangesuseHighlights(name, source, options)Not applicable
Custom review rail cardsDocxEditorReview with preset set to false, useReview().items, useStackedReviewPositions, and useReviewRailMetricsNot applicable
Comment-on-selection buttonDocxEditorReview.AddComment as a direct child of DocxEditorReview, or useEditorCommand('review.addComment')Not applicable
Page setup and paragraph dialogs from a custom toolbarDocxEditor.PageSetupDialog or DocxEditor.ParagraphDialog with open and a close handler (onClose in React, @close in Vue); enable the button from usePageSetup().isEnabled or useParagraphFormat().isEnabledSection.pageSetup, and Paragraph properties such as alignment

The review hooks need reviewModule() from @docx-editor.dev/pro in the editor's modules, and an editor author for comments and tracked changes. The editing API takes its author from the author option of DocxEditor.createServer, imported from @docx-editor.dev/editor-api, or of DocxEditor.createBrowser, imported from @docx-editor.dev/editor-api/browser.

Recipes

For the full hook reference, see React hooks and Vue composables. For the editing API, see Editing API.