- Home
- Skills
- Productivity
- Reorder a Word Document and Add a Clickable Contents Page
Reorder a Word Document and Add a Clickable Contents Page
by siyu liu
Moves sections of a Word document into the order you specify without touching their formatting, and builds a clickable contents page at the front.
$2
What it does
- Reorders sections without rewriting or reformatting the text
- Keeps images, tables and bullet numbering intact
- Generates a clickable contents page from internal bookmarks
- Refuses to save if any original paragraph would be lost
- Validates the XML order Word requires
- Can derive a draft outline from existing heading styles
About this skill
Reordering a report by hand loses formatting: fonts drift, images detach, numbering restarts. This skill moves the original paragraph elements instead of rewriting them, so every run, image, table and bullet keeps the formatting it already had.
It works in three steps. First it dumps the document as an indexed list of paragraphs with their styles, so you can see exactly which range belongs to which section. Then you write the target outline as a small JSON spec, mapping each heading to a range of paragraph indexes. Then it rebuilds the document, inserts the headings where they are missing, and generates a clickable contents page at the front.
The contents page uses internal bookmarks rather than a Word contents field, so the links still work when the file moves to another machine. Page numbers use a field that Word recalculates when the document opens.
Before saving, it checks that every original paragraph is covered exactly once, so content cannot be silently dropped, and it validates the XML element order that Word is strict about.
You supply the target outline as a JSON spec; it does not guess your intended order unless you use the auto-outline mode. Page numbers refresh in Word, or with a select-all and F9. Contents links are bookmarks, not a Word table-of-contents field.
One Python script using python-docx and lxml. Operates on word/document.xml, moving the original paragraph elements rather than regenerating them. Takes a JSON spec with source, destination and an ordered list of headings with paragraph ranges. Contains a schema-order self-check on paragraph and run properties, and an abort if the ranges leave any paragraph uncovered.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 day ago
- Software
Python 3.xpython-docx and lxml
Permissions
What's inside
Frequently Asked Questions
New in Productivity
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Productivity.