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.
doc.tables.mergeCells(…)Expected result
Returns a TableMutationResult receipt; reports NO_OP if the cells are already merged.
Inputs
targetTableAddressconditionally requiredFields
kind"block"requirednodeType"table"requirednodeIdstringrequirednodeIdstringconditionally requiredstartobjectrequiredFields
rowIndexintegerrequiredcolumnIndexintegerrequiredendobjectrequiredFields
rowIndexintegerrequiredcolumnIndexintegerrequired1 additional input field
keepAllContentbooleanSet 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
successtruerequiredappliedChangeMode"direct" | "tracked"tableTableAddressFields
kind"block"requirednodeType"table"requirednodeIdstringrequiredtrackedChangeRefsEntityAddress[]false
successfalserequiredfailureobjectrequiredFields
code"NO_OP" | "INVALID_TARGET" | "TARGET_NOT_FOUND" | "CAPABILITY_UNAVAILABLE"requiredmessagestringrequireddetailsunknownFailures
Pre-apply throws
TARGET_NOT_FOUNDINVALID_TARGETCAPABILITY_UNAVAILABLE
1 more codes
INVALID_CONTEXT
Non-applied receipt codes
INVALID_TARGETNO_OPINVALID_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