Use case
- Form templates — Create fillable documents with inline text fields and block content areas
- Contract generation — Dynamic clauses and terms that map to Word content controls
- Document automation — Programmatically update specific sections while preserving structure
- Protected fields — Lock modes control which fields users can edit or delete (ECMA-376
w:lock)
Quick start
Options
Configure the extension behavior:string
default:"sd-structured-content-block-tag"
CSS class for the block
Object
HTML attributes for structured content blocks
Attributes
Node attributes that can be set and retrieved:string
Unique identifier for the structured content block
The
id attribute must be a numeric string for valid DOCX output (per
ECMA-376
§17.5.2.18).
Use Date.now().toString() or sequential integers instead of UUIDs.string
Content control tag (e.g., ‘block_table_sdt’)
string
default:"Structured content"
Display name for the block
StructuredContentLockMode
default:"unlocked"
Controls editing and deletion restrictions on the structured content node. See Lock modes below.
Lock modes
Structured content nodes support four lock modes based on the OOXMLw:lock element (ISO/IEC 29500 §17.5.2.23). Lock modes control whether users can edit the content inside a field and whether they can delete the field wrapper itself.
Set the lock mode when inserting:
Lock modes round-trip through DOCX. A document with
w:lock elements in
its SDT properties will import with the correct lock mode and export the
w:lock element back to the saved file.Commands
insertStructuredContentInline
Inserts a structured content inline at the current selection.
Example:
StructuredContentInlineInsert
required
insertStructuredContentBlock
Inserts a structured content block at the current selection.
Example:
StructuredContentBlockInsert
required
updateStructuredContentById
Updates a single structured content field by its unique ID.
IDs are unique identifiers, so this will update at most one field.
If the updated node does not match the schema, it will not be updated.
Pass attrs alone to change attributes (like lockMode) without replacing content:
Example:
string
required
Unique identifier of the field
StructuredContentUpdate
required
deleteStructuredContent
Removes a structured content.
Parameters:
Array<any>
required
deleteStructuredContentById
Removes a structured content by ID.
Parameters:
string | Array<string>
required
deleteStructuredContentAtSelection
Removes a structured content at cursor, preserving its content.
updateStructuredContentByGroup
Update all structured content fields that share the same group identifier.
Example:
string
required
Group identifier to match
StructuredContentUpdate
Update options (same as
updateStructuredContentById)deleteStructuredContentByGroup
Remove all structured content fields that share the same group identifier.
Example:
string | Array<string>
required
Group identifier or array of group identifiers
appendRowsToStructuredContentTable
Append multiple rows to the end of a table inside a structured content block.
Each inner array represents the cell values for one new row.
Example:
StructuredContentTableAppendRowsOptions
required
Append configuration
Helpers
getStructuredContentBlockTags
Get all block-level structured content tags in the document
Example:
any
required
getStructuredContentInlineTags
Get all inline structured content tags in the document
Example:
any
required
getStructuredContentTablesById
Find all tables inside a structured content block by ID
Example:
string
required
Structured content block ID
any
required
getStructuredContentByGroup
Find all structured content nodes that share the same group identifier.
Example:
string | Array<string>
required
Group identifier or array of group identifiers
any
required
getStructuredContentTags
Get all structured content tags (inline and block) in the document
Example:
any
required
getStructuredContentTagsById
Get structured content tag(s) by ID
Example:
string | Array<string>
required
Single ID or array of IDs to find
any
required

