Document apiReferenceTables

tables.mergeCells

Merge a range of table cells into one. When every cell in the range holds the same plain text (compared after trimming whitespace), the merged cell keeps the first cell only, so the value appears once. Otherwise the merged cell keeps the content of every cell in the range, one paragraph after another, as Word does. The same holds for tracked merges, for tables that contain a nested table, for header and footer tables, and when a repeated cell carries review marks, comments or bookmarks. Some hosts do not apply the rule and always keep the content of every cell. To be certain of a single value, empty the other cells first with tables.setCellText and text "". Pass keepAllContent true to keep the content of every cell even when all cells hold the same text. The paragraphs of an empty cell are dropped either way.

mutates documenttracked modedry runconditional
doc.tables.mergeCells(…)

Expected result

Returns a TableMutationResult receipt; reports NO_OP if the cells are already merged.

Inputs

targetTableAddressconditionally required
Fields
kind"block"required
nodeType"table"required
nodeIdstringrequired
nodeIdstringconditionally required
startobjectrequired
Fields
rowIndexintegerrequired
columnIndexintegerrequired
endobjectrequired
Fields
rowIndexintegerrequired
columnIndexintegerrequired
1 additional input field
keepAllContentboolean

Set true to keep the content of every cell even when all cells hold the same text, as Word does. Defaults to false.

Result

Output fields
true
successtruerequired
appliedChangeMode"direct" | "tracked"
tableTableAddress
Fields
kind"block"required
nodeType"table"required
nodeIdstringrequired
trackedChangeRefsEntityAddress[]
false
successfalserequired
failureobjectrequired
Fields
code"NO_OP" | "INVALID_TARGET" | "TARGET_NOT_FOUND" | "CAPABILITY_UNAVAILABLE"required
messagestringrequired
detailsunknown

Failures

Pre-apply throws

  • TARGET_NOT_FOUND
  • INVALID_TARGET
  • CAPABILITY_UNAVAILABLE
1 more codes
  • INVALID_CONTEXT

Non-applied receipt codes

  • INVALID_TARGET
  • NO_OP
  • INVALID_CONTEXT
1 more codes
  • CAPABILITY_UNAVAILABLE

Raw schemas

Open the generated JSON artifact for the exact input, output, success, and failure schemas represented by this contract version.

View raw JSON schemas