change_heading_level
Promote or demote a Word heading by a specified level, optionally shifting all subordinate headings to preserve the document's structure. Prevents changes that would place headings outside valid levels.
Instructions
Promote (delta=-1) or demote (delta=1) a heading, addressed by exact heading_text or by paragraph_index. subtree=True also shifts every subordinate heading beneath it (until the next same-or-higher heading) by the same delta, keeping the branch's shape. Refuses, changing nothing, if any affected heading would leave levels 1-9 (the blocker is named) or if a heading's level comes from an outlineLvl override or custom style rather than a built-in Heading style (adjust those via set_paragraph_format's outline_level). Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| delta | Yes | ||
| backup | No | ||
| subtree | No | ||
| file_path | Yes | ||
| heading_text | No | ||
| paragraph_index | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||