Update Table of Contents in Power Automate
PDF4me Update Table of Contents action enables updating or creating Table of Contents in Word documents in Power Automate with comprehensive formatting options and professional styling capabilities. This powerful TOC management feature supports automatic detection of existing TOC fields, customizable heading levels, hyperlink support, tab leader control, text case options, and culture localization with full control over TOC appearance and functionality, perfect for document navigation, professional formatting, and automated TOC generation across Microsoft 365 workflows.
Authenticating Your API Request
To access the PDF4me Web API through Power Automate, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user, enabling seamless integration between your Power Automate flows and PDF4me's powerful Word TOC management services.

Key Features
- Automatic TOC Detection: Finds and updates existing TOC fields or creates new ones
- Customizable Heading Levels: Control which heading levels to include (1-6)
- Hyperlink Support: Enable or disable clickable links in the TOC
- Tab Leader Control: Show or hide dots between text and page numbers
- Text Case Options: Use uppercase or preserve original case
- Culture Localization: Support for different languages and regions
- Professional Formatting: Automatic application of professional TOC styling
- Page Number Integration: Automatic page number calculation and updates
Parameters
Complete list of parameters for the Update Table of Contents action. Configure these parameters to control TOC generation and formatting.
Important: Parameters marked with an asterisk (***) are required. Advanced parameters provide fine-grained control over TOC formatting and appearance.
| Parameter | Type | Description | Example |
|---|---|---|---|
| File Content*** | Base64 | Source Word File Content • Map Word file from previous action output • Supports Word files from SharePoint, Dropbox, OneDrive, email attachments • Can be dynamically retrieved from flow variables • All type of file content can get from the Dropbox Get File actions • Direct base64 can be given in the file content also • Must be valid Word document (.docx, .doc formats) • TOC is generated from this document's headings | [File Content from Get File] |
| File Name*** | String | Word Document Name • Specify Word file name with extension (.docx, .doc) • Used for processing and output file naming • Must include proper file extension • Supports dynamic naming from flow variables • Output filename matches input filename | document.docx |
| Heading Levels | String | Heading Levels to Include in TOC • Range format: "1-3" (includes heading levels 1, 2, and 3) • Single level: "1" (includes only heading level 1) • Multiple ranges: "1-2,4-6" (includes levels 1-2 and 4-6) • Default: "1-3" • Controls which heading levels appear in the TOC • Maps to Word's built-in heading styles • Scans document for existing TOC fields (FieldType.FieldTOC) • Creates new TOC at document start if none exists | "1-3" |
| Use Hyperlinks | Boolean | Include Hyperlinks in Table of Contents • Yes - TOC entries are clickable links to headings • No - TOC entries are plain text • Default: Yes • Enables navigation by clicking TOC entries • Works automatically in Word when enabled • Generates TOC field option \h when enabled • Updates fields multiple times for accuracy | Yes |
| Hide Tab Leader | Boolean | Hide Tab Leader Dots • Yes - No dots between text and page numbers • No - Dots between text and page numbers • Default: Yes • Tab leaders provide visual connection between text and page numbers • Affects TOC visual appearance • Generates TOC field option \z when enabled • Calls UpdateFields() and UpdatePageLayout() in sequence | Yes |
| Use Uppercase | Boolean | Use Uppercase for TOC Entries • Yes - TOC entries displayed in uppercase • No - TOC entries in original case • Default: Yes • Affects the display format of TOC entries • Applied to all TOC entries • Generates TOC field option \u when enabled • Adds "Table of Contents" title with Heading1 style | Yes |
| Culture Name | String | Document Culture/Locale • Culture code for document processing (e.g., "en-US", "de-DE", "fr-FR") • Default: null (no culture-specific processing) • Affects document language and formatting • Use valid culture codes for international documents • Used for metadata and localization handling | en-US |
Output
The PDF4me Update Table of Contents action returns comprehensive output data for seamless Power Automate flow integration:
- Table
- JSON
- Flow Integration
Table View
Response data in a structured table format:
| Parameter | Type | Description |
|---|---|---|
| document | Base64 | Word document with updated table of contents |
| Success | Boolean | true if operation successful, false if failed |
| Error Message | String | Error description (null if successful) |
| Errors | Array | List of detailed error information (empty array if successful) |
JSON Response Format
The raw JSON response from the action:
{
"document": "[Base64 Word Content with Updated Table of Contents]",
"Success": true,
"ErrorMessage": null,
"Errors": []
}
Error Response Example:
{
"document": null,
"Success": false,
"ErrorMessage": "Error updating table of contents",
"Errors": [
{
"Code": "TOC_ERROR",
"Message": "No headings found in document"
}
]
}
Power Automate Flow Usage
Use documents with updated table of contents in subsequent actions:
- Document Navigation: Create navigable documents for easy access
- Professional Formatting: Apply consistent TOC formatting to all documents
- Academic Standards: Meet academic and professional document requirements
- Document Distribution: Send well-structured documents to stakeholders
- Archive Management: Store documents with proper navigation structure
- SharePoint Publishing: Upload indexed documents to document libraries
Common Error Messages
Understanding and troubleshooting errors helps ensure smooth table of contents update workflows:
| Error Message | Cause | Solution |
|---|---|---|
| "Request is empty" | Request object is null | Provide valid request object |
| "Document is empty" | Document object is null | Provide valid Word document |
| "Error updating table of contents" | General exception during TOC update | Check document format and parameters. Review exception details in Errors array |
| "Error loading document from bytes" | Invalid or corrupted Word document | Verify the input document is a valid Word file (.docx) |
| "Error converting document to bytes" | Error during document conversion | Check document integrity and format |
| "No headings found in document" | Document does not contain heading styles | Ensure document has proper heading styles (Heading 1, Heading 2, etc.) |
| "Invalid heading levels specified" | HeadingLevels parameter contains invalid format | Use valid format like "1-3", "1", or "1-2,4-6" |
| "Invalid culture name provided" | Invalid CultureName format | Use valid culture format (e.g., en-US, fr-FR) |
Workflow Examples
The PDF4me Update Table of Contents action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:
- Automated Document Indexing
- Academic Paper Formatting
- Legal Document Navigation
- Multi-Language Document Support
Scenario: Automatically generate and update Table of Contents for all technical manuals.
Configuration:
- Heading Levels:
"1-4" - Use Hyperlinks:
Yes - Hide Tab Leader:
No - Use Uppercase:
No
Business Value:
- Time Savings: 30 minutes per manual (automated vs manual TOC creation)
- Consistency: 100% accurate TOC with proper page references
- Professional Quality: Enhanced document navigation and usability
Workflow:
- Trigger: Technical manual uploaded to SharePoint
- Update Table of Contents: Generate comprehensive TOC
- Quality Check: Verify TOC accuracy
- Distribution: Send indexed manual to users
Scenario: Standardize Table of Contents formatting for all academic papers.
Configuration:
- Heading Levels:
"1-3" - Use Hyperlinks:
Yes - Hide Tab Leader:
Yes - Use Uppercase:
Yes
Business Value:
- Academic Standards: Consistent formatting across all papers
- Efficiency: Automated TOC generation for research submissions
- Quality Assurance: Eliminates manual formatting errors
Workflow:
- Trigger: Research paper submitted
- Update Table of Contents: Apply academic formatting standards
- Review: Academic committee verification
- Publication: Submit formatted paper for review
Scenario: Create navigable Table of Contents for complex legal documents.
Configuration:
- Heading Levels:
"1-6" - Use Hyperlinks:
Yes - Hide Tab Leader:
No - Use Uppercase:
No
Business Value:
- Legal Efficiency: Quick navigation through complex legal documents
- Client Service: Enhanced document accessibility for clients
- Compliance: Proper document structure for legal requirements
Workflow:
- Trigger: Legal document finalized
- Update Table of Contents: Create comprehensive navigation
- Legal Review: Attorney verification of TOC accuracy
- Client Delivery: Send navigable document to client
Scenario: Generate localized Table of Contents for international documents.
Configuration:
- Heading Levels:
"1-3" - Use Hyperlinks:
Yes - Culture Name:
"de-DE"(German localization)
Business Value:
- Global Reach: Support for international document standards
- Localization: Proper formatting for different languages
- Consistency: Standardized TOC across all language versions
Workflow:
- Trigger: International document ready
- Update Table of Contents: Apply localized formatting
- Language Review: Native speaker verification
- Global Distribution: Send localized document worldwide
Industry Use Cases & Applications
- Legal Industry
- Education
- Healthcare
- Finance & Banking
- Manufacturing
- Government
Legal Industry Use Cases
- Contract Navigation: Create detailed TOC for complex contracts
- Legal Briefs: Generate navigable structure for court documents
- Compliance Manuals: Index regulatory requirements and procedures
- Case Documentation: Organize evidence and legal arguments
Education Use Cases
- Textbook Indexing: Create comprehensive TOC for educational materials
- Research Papers: Standardize academic document structure
- Course Materials: Organize curriculum content and resources
- Thesis Documentation: Structure graduate and doctoral work
Healthcare Use Cases
- Medical Manuals: Index procedures and protocols
- Research Documentation: Organize clinical study materials
- Training Materials: Structure healthcare education content
- Compliance Guides: Navigate regulatory requirements
Finance & Banking Use Cases
- Financial Reports: Create navigable structure for complex reports
- Policy Manuals: Index banking procedures and regulations
- Audit Documentation: Organize compliance and audit materials
- Investment Guides: Structure financial education content
Manufacturing Use Cases
- Technical Manuals: Create detailed TOC for equipment documentation
- Quality Procedures: Index manufacturing processes and standards
- Safety Guidelines: Organize workplace safety information
- Training Materials: Structure technical education content
Government Use Cases
- Policy Documents: Create navigable structure for government policies
- Regulatory Guides: Index compliance requirements and procedures
- Public Records: Organize government documentation
- Legislative Materials: Structure law and regulation documentation