Task recipes
Choose between the React and Vue review hooks and the Office.js-shaped editing API, then find the exact symbol for each common task.
Each recipe solves one task with a complete code sample. Choose the API first, then find the symbol for your task.
Which API for which job
Use the React or Vue adapter hooks, the review hooks, and DocxEditorReview from @docx-editor.dev/pro/react or @docx-editor.dev/pro/vue to build browser review controls. Use the editing API in @docx-editor.dev/editor-api for document automation. It follows the Office.js object model and runs in browser and server hosts.
| Task | Browser controls (React or Vue) | Document automation |
|---|---|---|
| Comment on found text | editor.findMatches, editor.selectMatch, then useReview().comment | body.search, then Range.insertComment |
| Reply to a thread | useReview().reply(item, text) | Comment.reply(text) |
| Record a tracked replacement | Suggesting mode, then editor.exec({ type: 'replaceMatch', match, text }) | document.changeTrackingMode = 'TrackMineOnly', then Range.insertText(text, 'Replace') |
| Propose an AI rewrite as tracked changes | prepareRewrite through DocxEditor.createBrowser | prepareRewrite from @docx-editor.dev/editor-api/agent |
| Accept or reject a change | useReview().accept(item) or useReview().reject(item) | Revision.accept() or Revision.reject() |
| Open a change without scrolling | useReview().setActive(key, { reveal: false }) | Not applicable: no viewport |
| Highlight ranges | useHighlights(name, source, options) | Not applicable |
| Custom review rail cards | DocxEditorReview with preset set to false, useStackedReviewPositions, and useReviewRailMetrics | Not applicable |
| Comment-on-selection button | DocxEditorReview.AddComment as a direct child of DocxEditorReview, or useEditorCommand('review.addComment') | Not applicable |
| Page setup and paragraph dialogs | DocxEditor.PageSetupDialog or DocxEditor.ParagraphDialog | Section.pageSetup, and Paragraph properties such as alignment |
Check prerequisites
- The review hooks need
reviewModule()from@docx-editor.dev/proin the editor's modules. - Comments and tracked changes need an author: the editor's
authorprop, or the runtime'sauthoroption. - Create a server runtime with
DocxEditor.createServerfrom@docx-editor.dev/editor-api. Create a browser runtime withDocxEditor.createBrowserfrom@docx-editor.dev/editor-api/browser. - Review controls stay separate from the Office.js-shaped document model.
@docx-editor.dev/proand@docx-editor.dev/editor-apirequire the EigenPal Pro License. For more information, see Pro features.