delete_element
Delete a Word document element by type: image, chart, hyperlink, bookmark, caption, content control, or reference list. Removes associated media and auto-backs up before saving.
Instructions
Delete one document element that has no lifecycle tool of its own.
type: equation | image | chart | bookmark | hyperlink | caption |
reference_list | content_control. Address equations, images, charts by
their list_elements index; reference_list (TOC, List of
Tables/Figures, index) by its read order; bookmarks by name (markers
go, the text stays; Word-internal underscore names refused); hyperlinks
by target url in id and/or a location search on the link text (the
link is unwrapped, display text kept, the relationship dropped once
unshared; several matches without occurrence refuse loudly listing
every candidate); captions by location (Caption-styled paragraphs
only); content controls by tag or index (the whole control including
content; locked controls refused). Deleting an image or chart also
removes its media, chart, and embedded-workbook parts once nothing else
references them. Objects with lifecycle tools stay there: notes in
manage_note (academic pack), comments in manage_comment (review
pack), sources in manage_source (references pack), tables in
delete_table, paragraphs in delete_paragraphs. 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 |
|---|---|---|---|
| id | No | ||
| type | Yes | ||
| backup | No | ||
| location | No | ||
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||