Skip to Content
SimulatorsWordOverview

Simulators

Word simulator

word-twin is a local, stateful simulator of the Word host that Office.js add-ins run in. Your add-in loads Microsoft’s office.js from its CDN unchanged. Each context.sync() sends a batch, and the simulator runs it as Word for the web does: paragraphs and ranges, search, tracked changes, comments and OOXML. It matches Word for the web except where a Differs from Word for the web: line or Limitations says otherwise. It never calls Word, Microsoft 365 or OneDrive, and it needs no Microsoft account and no sideloading.

Quickstart

Install the CLI, sign in and boot the simulator with RYSTIC_URL pointing at it. You also need Node 20 or newer and network access to appsforoffice.microsoft.com, where office.js loads from.

On Pro you sign in with an API key from your account .

curl -fsSL https://www.rystic.ai/install.sh | sh
rystic login rys_…   # your API key
export RYSTIC_URL=$(rystic run word-twin -d --port 0 --scenario word_contract_redlined --json | jq -r .data.url)
curl -s "$RYSTIC_URL/_rystic/version"
# -> {..."product":"word-twin"...}

On Enterprise, the licensed edition signs in with a license file in place of the key: rystic login ./rystic-license.json (licensing ).

First calls

Read the default scenario’s redline summary, then run the smallest test that edits it. The test is the call: your add-in reaches the simulator through Microsoft’s office.js.

curl -s "$RYSTIC_URL/_rystic/inspect?view=document" | jq -c '{trackingMode, changes, authors}'
# -> {"trackingMode":"Off","changes":6,"authors":["Alice","Bob"]}

Save this as redline.test.js. It turns tracking on, edits a clause and asserts both the tracked change and the reviewed text:

import { afterAll, beforeAll, beforeEach, expect, it } from 'vitest';
import { connect } from '@rystic/officejs-harness';

let office;
beforeAll(async () => {
  office = await connect();            // office.js from Microsoft's CDN, the simulator as its host
  office.install();                    // Office, OfficeExtension and Word as globals
}, 60000);
beforeEach(() => office.reset());      // a fresh document for every test
afterAll(() => office.close());

it('tracks a clause edit and reads the redline both ways', async () => {
  await Word.run(async context => {
    const body = context.document.body;
    body.insertParagraph('The Supplier shall deliver the Goods within 30 days of the order.', 'End');
    context.document.changeTrackingMode = Word.ChangeTrackingMode.trackAll;
    const hits = body.search('30 days', { matchCase: true });
    hits.load('items');
    await context.sync();
    hits.items[0].insertText('45 days', 'Replace');
    await context.sync();
  });

  const result = await Word.run(async context => {
    const changes = context.document.body.getTrackedChanges();
    changes.load('items/type,items/text');
    const whole = context.document.body.getRange('Whole');
    const current = whole.getReviewedText('Current');
    const original = whole.getReviewedText('Original');
    await context.sync();
    return {
      changes: changes.items.map(c => ({ type: c.type, text: c.text })),
      current: current.value,
      original: original.value,
    };
  });

  expect(result.changes).toEqual([
    { type: 'Added', text: '45 days' },
    { type: 'Deleted', text: '30 days' },
  ]);
  expect(result.current).toContain('within 45 days of the order.');
  expect(result.original).toContain('within 30 days of the order.');
});
npm install --save-dev "$RYSTIC_URL/officejs/harness.tgz" vitest
RYSTIC_TWIN_URL="$RYSTIC_URL" npx vitest run redline.test.js
# -> ...Tests  1 passed (1)...

In a real suite your add-in’s own modules make the Word.run calls, and the test imports and calls them. To start from a contract, load a scenario or your own .docx (Seeding state).

Connect your client

Install @rystic/officejs-harness from the running simulator. It loads Microsoft’s office.js with the simulator as its Word host, for Jest, Vitest, Playwright or a person in a browser. Batching, proxies, load(), track() and OfficeExtension.Error stay Microsoft’s, so a test exercises your code and Microsoft’s library together. The harness is MIT-licensed, and each simulator serves the harness version built for it, so commit the lockfile entry:

npm install --save-dev "$RYSTIC_URL/officejs/harness.tgz"

After the quickstart, run export RYSTIC_TWIN_URL="$RYSTIC_URL". connect(), openAddin and officejs-harness serve read it. Their twin option, --twin for serve, overrides it.

Jest or Vitest, in Node

connect() loads office.js into a jsdom window whose parent frame is the simulator, and resolves once Office.onReady has. Your add-in’s modules call Word.run unchanged. connect() runs under Jest’s default node test environment too, so you need no jsdom test environment:

const { connect } = require('@rystic/officejs-harness');

let office;
beforeAll(async () => { office = await connect(); office.install(); }, 60000);
beforeEach(() => office.reset());
afterAll(() => office.close());

Give beforeAll a hook timeout, because office.js takes a few seconds to load from its CDN. connect() takes these options:

OptionDefaultWhat
twin$RYSTIC_TWIN_URL, else http://127.0.0.1:8080the running simulator
addinhttps://localhost:3000/the https URL your add-in’s page claims; office.js trusts its host only on that hostname
nameAdd-inthe add-in’s display name
officeJsMicrosoft’s CDN office.jswhere to load office.js from
timeout60000how long office.js may take to load, in milliseconds
resetTo$OFFICEJS_HARNESS_DOCXa .docx every office.reset() seeds after resetting

What connect() resolves to:

  • office.install() puts Office, OfficeExtension and Word on the global object, so add-in modules that read them as globals run unchanged. It returns a function that puts back what was there.
  • office.reset() resets the simulator (Determinism and reset), then seeds resetTo when you set it.
  • office.seedDocx(path) seeds a .docx file or its bytes. Call office.reset() first (Seeding state).
  • office.mark(), office.stats() and office.batches() count the batches the simulator runs (Sync counts).
  • office.docx() resolves to the document as a .docx (Saved document).
  • office.close() closes the window. office.window, office.host ('Word') and office.namespace (the Word object) are there for anything else.

Compare what office.js returns by value: objects and arrays come from the jsdom window, so use toEqual, because toStrictEqual rejects them for their prototype. Set OFFICEJS_HARNESS_DEBUG=1 to see office.js’s own console, and HTTPS_PROXY if you reach the CDN through a proxy (NO_PROXY lists hosts to reach directly).

In a browser

office.js trusts a host without prompting only when the host page is served over https on the add-in’s own hostname. The simulator’s host page is /officejs/host?addin=<your task pane URL>, with an optional &name=<display name>. Front it in one of three ways.

With Playwright, openAddin routes the host page and your built files inside the browser context, so no certificate is needed:

const { chromium } = require('playwright-core');
const { openAddin } = require('@rystic/officejs-harness/browser');

const browser = await chromium.launch();
const { frame } = await openAddin(await browser.newContext(), {
  root: 'dist', addin: 'https://localhost:3000/taskpane.html',
});
await frame.getByRole('button', { name: 'Redline' }).click();

By hand, officejs-harness serve opens an https front on localhost with the certificate that npx office-addin-dev-certs install trusts. Open the URL it prints:

npx officejs-harness serve --root dist                                    # your built add-in
npx officejs-harness serve --addin https://localhost:3000/taskpane.html   # your dev server

serve takes these flags, and openAddin these options:

serve flagopenAddin optionDefaultWhat
--twin URLtwin$RYSTIC_TWIN_URL, else http://127.0.0.1:8080the running simulator
--root DIRrootnoneserves your built add-in from that folder
--addin URLaddin/taskpane.html on the front for serve, https://localhost:3000/taskpane.html for openAddinthe add-in page to frame
--name NAMEnameAdd-inthe add-in’s display name
--port N8443the front’s port
--cert FILE, --key FILE~/.office-addin-dev-certs/localhost.crt and .keythe TLS certificate and key
fronthttps://localhost:8443the host page’s origin
timeout60000how long the add-in may take to be ready, in milliseconds

With your own dev server, proxy /officejs to $RYSTIC_URL, then open https://localhost:3000/officejs/host?addin=https://localhost:3000/taskpane.html.

No client has been checked against this simulator yet.

Auth

The simulator takes no credential. office.js sends none, and POST /officejs/ProcessQuery returns the same with or without one.

API version

The simulator declares the requirement sets WordApi 1.6 and WordApiSearchFlags 1.1 in its handshake at POST /officejs/message, but serves only the members Coverage lists. Office.context.requirements.isSetSupported('WordApi', '1.6') returns true, and '1.7' returns false. So an add-in that checks for a set before using a newer member takes its fallback here, as it would in an older Word. An older set’s check passes too: isSetSupported('WordApi', '1.3') returns true, yet body.contentControls, from WordApi 1.1, returns ApiNotFound.

Nothing pins a version, whatever requirement set the add-in asks for.

Errors and limits

Error format

A refused call fails its context.sync() with office.js’s own OfficeExtension.Error, with Word’s error code. The batch’s response has an Error with Word’s Code and Message, the failed action’s ActionIndex and a Location. Location names the class and member, such as Body._search2. An error on an object path, such as InvalidReference, has an empty Location, and InvalidRequest has none. The simulator returns these codes:

CodeReturned for (example)
ItemNotFounda reach that finds nothing, such as getNext on the last paragraph; an OrNullObject form returns the null object instead
InvalidArgumenta location the member does not take, a property the simulator does not serve, or a malformed wildcard search
InvalidRequesta value outside its enum, such as a changeTrackingMode of 'Bogus'
GeneralExceptioninsertOoxml of anything but a flat pkg:package
NotAllowedan edit Word for the web refuses in a content control, or a reply on a resolved thread
ApiNotFounda method, object-valued property or property write the simulator does not serve (Coverage)
InvalidReferencean object reference the simulator no longer tracks, such as one from before a reset
NotImplementedan action type the simulator does not serve

An enum argument takes any case, as in Word.

Rate limits

Not applicable: the simulator runs every context.sync() batch your add-in sends to POST /officejs/ProcessQuery and throttles none.

Network profiles add 429s and latency to any simulator. To hold an add-in to a sync budget, count its syncs (Sync counts).

Microsoft publishes no request rate  for Word’s JavaScript API. Its CPU and memory limits on add-ins apply only in Office on Windows and Mac. With no limit to hold, rate_limits: real changes nothing for Word.

Pagination

Not applicable: Word’s Office.js collections, such as paragraphs, getTrackedChanges() and search() results, load all their items in one context.sync().

Idempotency

Not applicable: the simulator runs each batch it receives, so a batch sent again edits the document again.

Coverage

The simulator serves the Office.js members below, over one open document. It does not serve:

  • the rest of WordApi 1.1 to 1.9: tables, lists, content controls, fields, styles, fonts and formatting, images, sections, headers and footers, bookmarks, footnotes, the selection and every event. A seeded document can still have tables and content controls (Tables, Content controls);
  • SearchOptions.newObject: pass search a plain options object instead;
  • the WordApiDesktop and WordApiHiddenDocument members, which Word for the web does not support either.

93 Office.js operations, served over 5 routes, counted from the simulator’s route table.

Show all operations
ResourceOperations
Word.Body (13)Word.Body.clear; Word.Body.getComments; Word.Body.getOoxml; Word.Body.getRange; Word.Body.getReviewedText; Word.Body.getTrackedChanges; Word.Body.insertOoxml; Word.Body.insertParagraph; Word.Body.insertText; Word.Body.load; Word.Body.paragraphs; Word.Body.search; Word.Body.text
Word.Comment (13)Word.Comment.authorEmail; Word.Comment.authorName; Word.Comment.content; Word.Comment.content (set); Word.Comment.creationDate; Word.Comment.delete; Word.Comment.getRange; Word.Comment.id; Word.Comment.load; Word.Comment.replies; Word.Comment.reply; Word.Comment.resolved; Word.Comment.resolved (set)
Word.CommentCollection (3)Word.CommentCollection.getFirst; Word.CommentCollection.items; Word.CommentCollection.load
Word.CommentReply (6)Word.CommentReply.authorName; Word.CommentReply.content; Word.CommentReply.content (set); Word.CommentReply.delete; Word.CommentReply.id; Word.CommentReply.load
Word.CommentReplyCollection (2)Word.CommentReplyCollection.items; Word.CommentReplyCollection.load
Word.Document (4)Word.Document.body; Word.Document.changeTrackingMode; Word.Document.changeTrackingMode (set); Word.Document.load
Word.Paragraph (15)Word.Paragraph.delete; Word.Paragraph.getComments; Word.Paragraph.getNext; Word.Paragraph.getNextOrNullObject; Word.Paragraph.getOoxml; Word.Paragraph.getPrevious; Word.Paragraph.getPreviousOrNullObject; Word.Paragraph.getRange; Word.Paragraph.getReviewedText; Word.Paragraph.getTrackedChanges; Word.Paragraph.insertOoxml; Word.Paragraph.insertText; Word.Paragraph.load; Word.Paragraph.search; Word.Paragraph.text
Word.ParagraphCollection (4)Word.ParagraphCollection.getFirst; Word.ParagraphCollection.getLast; Word.ParagraphCollection.items; Word.ParagraphCollection.load
Word.Range (13)Word.Range.delete; Word.Range.getComments; Word.Range.getOoxml; Word.Range.getRange; Word.Range.getReviewedText; Word.Range.getTrackedChanges; Word.Range.insertComment; Word.Range.insertOoxml; Word.Range.insertText; Word.Range.load; Word.Range.paragraphs; Word.Range.search; Word.Range.text
Word.RangeCollection (3)Word.RangeCollection.getFirst; Word.RangeCollection.items; Word.RangeCollection.load
Word.RequestContext (1)Word.RequestContext.document
Word.TrackedChange (10)Word.TrackedChange.accept; Word.TrackedChange.author; Word.TrackedChange.date; Word.TrackedChange.getNext; Word.TrackedChange.getNextOrNullObject; Word.TrackedChange.getRange; Word.TrackedChange.load; Word.TrackedChange.reject; Word.TrackedChange.text; Word.TrackedChange.type
Word.TrackedChangeCollection (6)Word.TrackedChangeCollection.acceptAll; Word.TrackedChangeCollection.getFirst; Word.TrackedChangeCollection.getFirstOrNullObject; Word.TrackedChangeCollection.items; Word.TrackedChangeCollection.load; Word.TrackedChangeCollection.rejectAll

Also served, outside the model: POST /officejs/ProcessQuery, GET /officejs/harness.tgz, GET /officejs/host, POST /officejs/message, GET /officejs/relay.js.

Feed effects. No write emits a feed effect; watch requests instead. Each call appears on the event feed (/_rystic/events) as a request event, and reading the record back shows what it changed.

Scenarios

The simulator ships 2 scenarios; the quickstart boots word_contract_redlined.

ScenarioWhat it is forWhat it seedsClock
word_contract_cleanThe default scenario’s NDA with every change accepted and no commentsdocument 12026-02-02T00:00:00Z
word_contract_redlined (default)A mutual NDA mid-negotiationdocument 12026-02-02T00:00:00Z

What each scenario holds:

  • word_contract_clean: A clean contract to redline from scratch.
  • word_contract_redlined: Alice’s and Bob’s tracked insertions and deletions, Alice’s comment on the counterparty with Bob’s reply and a resolved comment.

Boot one by name, or load one into a running simulator:

rystic run word-twin -d --port 0 --scenario word_contract_redlined
curl -s -X POST "$RYSTIC_URL/_rystic/scenario" -d '{"name":"word_contract_redlined"}'

What the scenarios do not hold

  • No formatting. Each paragraph is plain text in the default style, with no tables, lists, content controls, headers, footers or images. Seed your own .docx for those.
  • No real identities. Alice and Bob have no email address, and no name or date comes from a real account.
  • Dates before the clock. Every revision and comment is dated in January 2024, before the scenario’s clock, so an edit your add-in makes is always the newest.

Seeding state

The simulator has one register, state_document, with one record, main: the open document. To start a test from your own contract, reset, then send a record to POST /_rystic/seed. A seed merges into the record. A scenario load or a body seed leaves the document in parts until the next Office.js batch writes it back as a .docx. Without a reset, a seed in between keeps the parts it leaves out, and a docx seed is ignored. Give the document as a .docx or by its parts:

KeyValue
docxa base64 .docx
bodythe inner XML of w:body, as the shipped scenarios are written
comments, commentsExtended, commentsIds, commentsExtensible, people, settingsoptional, beside body: the inner XML of that part
curl -s -X POST "$RYSTIC_URL/_rystic/reset"
curl -s -X POST "$RYSTIC_URL/_rystic/seed" -d '{"state_document":{"main":{"body":"<w:p><w:r><w:t>Payment is due in 30 days.</w:t></w:r></w:p>"}}}'
curl -s "$RYSTIC_URL/_rystic/inspect?view=document" | jq -c '{changes, text: [.blocks[].runs[].text]}'
# -> {"changes":0,"text":["Payment is due in 30 days."]}

Seeding has the seed route’s contract and the --seed boot file. A seed’s revisions, comments, authors and dates come through as written, so one seed can have redlines from several authors.

A seed with no styles, theme, font-table or web-settings part reads back with Word’s default ones, as Word imports it. Its settings read back with Word’s defaults for those it leaves out. Every part a .docx seed has is kept.

From a test, reset, then call office.seedDocx; connect({ resetTo }) does both on every office.reset():

beforeEach(async () => {
  await office.reset();
  await office.seedDocx('fixtures/msa.docx');
});

Features

Each feature has its own page:

  • Comments: Comments anchored on a range, with replies, resolved threads and deletes, as Word for the web handles them.
  • Content controls: How edits behave in and around a seeded document’s content controls: locks, date pickers, row controls and block or inline conversion.
  • Corpus runner: Runs your suite once per .docx in a folder, each document on its own freshly seeded simulator, and prints a documents by tests matrix.
  • Document view: The open document drawn the way Word’s review view does, redrawn as each context.sync() lands.
  • Editing text: What insertText, delete, clear and Replace leave behind: the last paragraph, a paragraph’s whole range and edits across paragraph marks.
  • insertOoxml Replace across paragraphs: What insertOoxml’s Replace does over a range that crosses paragraph marks, table cells or a content control’s edge, with tracking off and on.
  • getOoxml and insertOoxml: Read and write the document as Word for the web does, flat OPC packages with tracked changes and comments in their parts.
  • Ranges and collections: Where a range sits after later edits, and what a collection lists once the document changes under it.
  • Ranges and insertOoxml: Where ranges sit after an insertOoxml: the ranges it puts back, the paragraph it splits and a package that starts or ends with a table.
  • Saved document: The simulator’s document as a .docx, with every edit your add-in made, revisions and comments included.
  • Spaces: When a space reads as a plain or a no-break space, and which edits change it.
  • Sync counts: Count the context.sync() batches your add-in sends and name each action, to hold an operation to a sync budget.
  • Tables: How edits and getOoxml behave in a seeded document’s tables, at a cell’s edge and in its last cell.
  • Tracked changes and reviewed text: Tracked insertions and deletions listed, accepted and rejected one at a time or all at once, with the text read as it was and as it will be.

Determinism and reset

The same edits from the same reset give byte-identical OOXML and .docx files, unless the clock moves with wall time.

An empty boot and POST /_rystic/reset (office.reset()) open a blank document. A reset also clears the batch counts and forgets every reference office.js held, so objects from before it are no longer valid: create new ones in a new Word.run. One simulator has one document: run suites that share it one file at a time (Vitest fileParallelism: false, Jest --runInBand), or start one per worker with rystic run word-twin -d --port 0. Reset and determinism covers reset, the clock and the RNG.

Limitations

Known issues.

  • In Word for the web, text reads a paragraph’s leading tabs as nothing and a search for them finds nothing, while getOoxml keeps them. The simulator reads the tabs.
  • In Word for the web, body.contentControls lists no content control around a whole table. The simulator serves no contentControls member, so a call to it returns ApiNotFound.
  • In Word for the web, getOoxml can throw GeneralException (ooxmlIsMalformated) once text goes in right after a tab, and the document then refuses every insertOoxml. It throws after an untracked insertText of a space. It throws after a tracked insertText when a stretch of its text between tabs, or all of it without a tab, has anything but spaces after its first character, such as X or Hello. A tracked insertText of X\tY writes three tabs instead. The simulator’s getOoxml writes the text as tabs, and the document stays usable.
  • In Word for the web, a tracked insertText Before a search hit that starts an inline content control right after a tab lands inside the control. The control then leaves the body’s getOoxml. The simulator puts the text before the control and keeps it.
  • In Word for the web, a range that a paragraph’s delete() collapsed to the next paragraph’s start, not reached since, throws ItemNotFound after most insertOoxml splits of the paragraph after that one. After the rest, it reads empty. The simulator always reads it empty.
  • In Word for the web, text inserted through a range at a block content control’s outer edge lands outside the control, which turns inline. Such a range is the After of the paragraph before it, its first paragraph’s Start or its only paragraph’s Whole range’s End. The simulator writes inside the control.
  • In Word for the web, a delete or Replace across a paragraph mark can leave the mark’s run properties and keep a block control. It does when it goes through a span from a search hit made in a sync that only read. The simulator behaves as for a hit from a sync that wrote. Workaround: Make the hit in a sync that writes, such as one that sets changeTrackingMode; Word then behaves as the simulator does.
  • In Word for the web, a search collection loaded again lists a hit an edit moved, and that your add-in hasn’t read or touched since, at its old offsets. The simulator lists it where it moved. Workaround: Read the hit itself before you rely on its offsets; Word then lists it where it moved.
  • In Word for the web, a package table that goes in right after a table, with a table style no part defines, loses that style and joins that table. Word also writes its indent as grid offsets. The simulator keeps the style, keeps the tables apart and drops the indent.
  • In Word for the web, insertOoxml of a package with a block content control changes the control. One around the package’s last paragraph becomes an inline control joined to the text after it, and one around a table moves into the table’s cell. The simulator keeps both as block controls.
  • In Word for the web, a TrackAll insertOoxml of a package with a move drops the moved text from both places and writes the first paragraph’s text twice. The simulator keeps the moved text in both.
  • In Word for the web, after a multi-paragraph insertOoxml splits a paragraph, the first part’s mark has none of the split paragraph’s mark run properties. The simulator copies them.
  • In Word for the web, rejecting a second time an insertion that included its paragraph mark, after it settled, also takes the mark out, which joins the paragraph or throws GeneralException. The simulator takes out only the text.

Beyond the known issues, 778 of the 871 operations in the published spec are not served, 3 documented responses have no test yet and 202 behaviors are not modeled. The details follow.

Show all limitations

Not served. 778 of the 871 operations in the published spec are not served.

  • Word.Body, 13 of 41 served: Word.Body.contentControls, Word.Body.endnotes, Word.Body.fields, Word.Body.font, Word.Body.footnotes, Word.Body.getContentControls, Word.Body.getHtml, Word.Body.inlinePictures, … and 20 more
  • Word.Comment, 13 of 14 served: Word.Comment.contentRange
  • Word.CommentCollection, 3 of 4 served: Word.CommentCollection.getFirstOrNullObject
  • Word.CommentReply, 6 of 10 served: Word.CommentReply.authorEmail, Word.CommentReply.contentRange, Word.CommentReply.creationDate, Word.CommentReply.parentComment
  • Word.CommentReplyCollection, 2 of 4 served: Word.CommentReplyCollection.getFirst, Word.CommentReplyCollection.getFirstOrNullObject
  • Word.Document, 4 of 35 served: Word.Document.addStyle, Word.Document.close, Word.Document.contentControls, Word.Document.customXmlParts, Word.Document.deleteBookmark, Word.Document.getAnnotationById, Word.Document.getBookmarkRange, Word.Document.getBookmarkRangeOrNullObject, … and 23 more
  • Word.Paragraph, 15 of 79 served: Word.Paragraph.alignment, Word.Paragraph.alignment (set), Word.Paragraph.attachToList, Word.Paragraph.clear, Word.Paragraph.contentControls, Word.Paragraph.detachFromList, Word.Paragraph.endnotes, Word.Paragraph.fields, … and 56 more
  • Word.ParagraphCollection, 4 of 6 served: Word.ParagraphCollection.getFirstOrNullObject, Word.ParagraphCollection.getLastOrNullObject
  • Word.Range, 13 of 63 served: Word.Range.clear, Word.Range.compareLocationWith, Word.Range.contentControls, Word.Range.endnotes, Word.Range.expandTo, Word.Range.expandToOrNullObject, Word.Range.fields, Word.Range.font, … and 42 more
  • Word.RangeCollection, 3 of 4 served: Word.RangeCollection.getFirstOrNullObject
  • Word.RequestContext, 1 of 2 served: Word.RequestContext.application
  • Not served at all: Word.Annotation (5), Word.AnnotationCollection (4), Word.Application (5), Word.CheckboxContentControl (3), Word.ComboBoxContentControl (4), Word.CommentContentRange (14), Word.ContentControl (70), Word.ContentControlCollection (11), Word.ContentControlListItem (9), Word.ContentControlListItemCollection (4), Word.CritiqueAnnotation (5), Word.CustomProperty (6), Word.CustomPropertyCollection (7), Word.CustomXmlPart (13), Word.CustomXmlPartCollection (7), Word.CustomXmlPartScopedCollection (7), Word.DocumentCreated (2), Word.DocumentProperties (28), Word.DropDownListContentControl (4), Word.Field (22), … and 26 more

Not tested. 140 tests compare the simulator with the real service. 3 documented responses have no test yet:

OperationStatusWhy
Word.Body.search200no known request reaches it
Word.Paragraph.search200no known request reaches it
Word.Range.search200no known request reaches it

Not modeled. Behavior the simulator does not model, by operation:

  • Word.ErrorCodes lists InvalidArgument, ItemNotFound, AccessDenied, GeneralException, NotAllowed, NotImplemented, SearchDialogIsOpen and SearchStringInvalidOrTooLong as the error codes reachable on this member (e.g. an insertLocation other than Start or End would be InvalidArgument). (Word.Body.insertParagraph)
  • Whether the host enforces a maximum reply length, or rejects an empty replyText, is undocumented here. (Word.Comment.reply)
  • The member references Word.ErrorCodes (ItemNotFound for a reply the batch can no longer resolve, AccessDenied, GeneralException, NotImplemented). (Word.CommentReply.content)
  • ItemNotFound: the operation description states the member throws an ItemNotFound error when the receiver is the first paragraph (Word.ErrorCodes lists the code). (Word.Paragraph.getPrevious)
  • Whether the receiver paragraph must still exist when the batch runs (an ItemNotFound after a prior delete in the same batch) is undocumented. (Word.Paragraph.getReviewedText)
  • Word for the web refuses a bare <w:p> fragment sent as ooxml with GeneralException, Message “unknown”, and accepts a flat-OPC pkg:package holding /_rels/.rels and /word/document.xml parts (the example) on a new paragraph at End and at Replace. (Word.Paragraph.insertOoxml)
  • Documented ItemNotFound error when the paragraph collection is empty (operation description; Word.ErrorCodes enum). (Word.ParagraphCollection.getFirst)
  • The exact composition of the OOXML package a host returns (which parts it carries beyond /word/document.xml) is not documented; the success example stands for shape only. (Word.Range.getOoxml)
  • Which codes this member actually raises, and on what condition (e.g. an invalid or empty commentText, a range the host refuses to comment on, a document opened read-only), is unresolved. (Word.Range.insertComment)
  • Whether a RangeCollection receiver is reachable without arguments is not documented; the example walks the open document -> body -> search(“Office”), whose match set depends on the open document’s content. (Word.RangeCollection.load)
  • … and 192 more

By design.

  • One author. The simulator edits as one signed-in user (Edit authors).
  • No layout. The simulator keeps the document’s content, not its pages: no pagination, page numbers, headers or footers, and the Document view draws no page.
  • office.js comes from Microsoft’s CDN. Pass connect({ officeJs }) to load a copy you host.

Release notes: Changelog

Last updated on