style_create
Add a paragraph, character, table, or numbering style with parent, next, and linked styles, plus run and paragraph formatting in a Word document.
Instructions
Add a new paragraph, character, table or numbering style with its parent (based_on), next and linked styles and run and paragraph formatting (e.g. run {"bold": true, "size_pt": 14}; paragraph in twips). id defaults from name. Refused (STYLE_CONFLICT) when the id or name exists: use style.update to change a style, style.rename to rename one, styleset.install to add many. Not a tracked change, but history.undo takes it back: the file is backed up first (backup); dry_run previews.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Style id (default: from the name). | |
| doc | Yes | Path to the .docx. | |
| run | No | Character formatting: bold, italic, small_caps, strike, underline, font, size_pt, color, highlight, vertical_align; null removes a key. | |
| link | No | Linked paragraph/character style; '' for none. | |
| name | Yes | Display name. | |
| next | No | Style of the next paragraph; '' for none. | |
| type | No | Kind of style (default paragraph). | |
| quick | No | Show in the quick-style gallery. | |
| custom | No | A user-defined (not built-in) style. | |
| expect | No | Write guard: the sha256 read earlier (doc.info, or a reply's doc.sha256), e.g. {"sha256": "9f86d081…"}; a file changed since is DOC_CHANGED_ON_DISK. | |
| default | No | The default style of its type. | |
| dry_run | No | Preview only; write nothing. | |
| based_on | No | Parent style id or name; '' for none. | |
| paragraph | No | Paragraph formatting (twips): alignment, indent{left,right,first_line,hanging}, spacing{before,after,line,line_rule}, keep_next, keep_lines, page_break_before, outline_level; null removes a key. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Always true on success. | |
| op | Yes | The operation that ran. | |
| api | Yes | API version (1.0). | |
| doc | No | The document read or written: path, sha256 and paragraph count. | |
| next | Yes | Cursor for the next page (pass as cursor), or null. | |
| result | Yes | What the operation returns. | |
| warnings | Yes | Things to know about the result. |