Skip to main content

Merge Documents in Power Automate

PDF4me Merge Documents action enables combining multiple Word documents into a single document in Power Automate with advanced formatting and compliance options. This powerful document merging feature supports flexible document ordering, customizable formatting modes, compliance level settings, timezone metadata, and intelligent style handling with full control over merge behavior, perfect for document assembly, report consolidation, and content management workflows across Microsoft 365.

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 document merging services.

Merge Documents Power Automate

Key Features

  • Multiple Document Support: Merge unlimited number of Word documents into one
  • Flexible Ordering: Control merge order with customizable SortPosition values
  • Formatting Options: Choose how to handle styles during merge process
  • Compliance Settings: Apply different compliance levels (ECMA, Transitional, Strict)
  • Timezone Metadata: Add timezone information for document tracking
  • Style Management: Intelligent handling of document styles and formatting
  • Base Document Concept: First document becomes the foundation for merging
  • Metadata Preservation: Maintain document properties and custom metadata

Parameters

Complete list of parameters for the Merge Documents action. Configure these parameters to control document merging behavior.

Important: Parameters marked with an asterisk (***) are required. The Documents array must contain at least one document with all required properties.

Documents to Merge

ParameterTypeDescriptionExample
Documents***ArrayArray of Documents to Merge
• Array of document objects to be merged
• Must contain at least one document
• Documents are merged in SortPosition order
• Each document object requires Filename, DocContent, and SortPosition
• FormatMode is optional for each document
[{"Filename": "doc1.docx", "DocContent": "...", "SortPosition": 0}]
Documents[].Filename***StringDocument Filename
• Original filename of the document
• Used for reference and processing
• Must include proper file extension (.docx, .doc)
• Supports dynamic naming from flow variables
• Used for document identification during merge
"document1.docx"
Documents[].DocContent***Base64Document Content
• Base64-encoded content of the document
• Map from previous action output or file upload
• Supports Word files from SharePoint, Dropbox, OneDrive, email attachments
• Can be dynamically retrieved from flow variables
• Direct base64 can be given in the file content also
• Must be valid Word document (.docx, .doc formats)
[File Content from Get File]
Documents[].SortPosition***Number (int)Merge Order Position
• Position in merge order (0-based or custom numbering)
• Documents are merged in ascending SortPosition order
• Lowest SortPosition becomes the base document
• Must be unique within the Documents array
• Can use any numbering scheme (0,1,2 or 10,20,30)
0
Documents[].FormatModeStringFormatting Mode
KeepSourceFormatting - Preserves original formatting from source document (default)
KeepDifferentStyles - Keeps different styles, merges similar ones
UseDestinationStyles - Uses formatting from the destination document
• Controls how styles are handled during merge
"KeepSourceFormatting"

Advanced Parameters (Merge Options)

ParameterTypeDescriptionExample
Merge Options Time ZoneStringDocument Timezone
• Time zone for document metadata (e.g., "UTC", "Asia/Kolkata", "America/New_York")
• Added as custom document property
• Used for document tracking and compliance
• Supports standard timezone identifiers
• Default: null (no timezone metadata)
"UTC"
Merge Options Compliance LevelStringDocument Compliance Level
ECMA - ECMA-376 2006 standard compliance
Transitional - ISO 29500:2008 Transitional compliance (default)
Strict - ISO 29500:2008 Strict compliance
Custom - Custom compliance level
• Affects document OOXML compliance
"Transitional"

Document Merge Order:

  • Documents are merged in ascending SortPosition order
  • Document with lowest SortPosition becomes the base document
  • All other documents are appended to the base document
  • SortPosition values can be any integers (0,1,2 or 10,20,30)

Output

The PDF4me Merge Documents action returns comprehensive output data for seamless Power Automate flow integration:

Table View

Response data in a structured table format:

ParameterTypeDescription
documentBase64Merged Word document containing all input documents
SuccessBooleantrue if operation successful, false if failed
Error MessageStringError description (null if successful)
ErrorsArrayList of detailed error information (empty array if successful)

Common Error Messages

Understanding and troubleshooting errors helps ensure smooth document merging workflows:

Error MessageCauseSolution
"Request is empty"Request object is nullProvide valid request object
"No documents to merge"Documents array is null or emptyProvide at least one document in the Documents array
"Error merging documents"General exception during document mergingCheck document formats, ensure all are valid Word documents, review exception details in Errors array
"Error loading document from bytes"Invalid or corrupted Word documentVerify all input documents are valid Word files (.docx)
"Unknown FormatMode, defaulting to KeepSourceFormatting"Invalid FormatMode value providedUse valid FormatMode values: KeepSourceFormatting, KeepDifferentStyles, UseDestinationStyles

Workflow Examples

The PDF4me Merge Documents action in Power Automate provides comprehensive workflow templates designed for real-world business scenarios:

Automated Report Assembly Workflow

Streamline your report generation with automated document merging:

Complete Workflow Steps:

  1. Trigger: All report sections completed in SharePoint report folder
  2. Get Cover Page: Retrieve cover page document (SortPosition = 0)
  3. Get Executive Summary: Retrieve executive summary (SortPosition = 1)
  4. Get Main Content: Retrieve main report content (SortPosition = 2)
  5. Get Appendices: Retrieve appendix documents (SortPosition = 3)
  6. Merge Documents: Combine all sections in proper order
  7. Set Formatting: FormatMode = "KeepSourceFormatting" for all documents
  8. Set Compliance: Compliance Level = "Transitional" for standard compliance
  9. Email Final Report: Send merged report to stakeholders
  10. Archive Report: Store final report in reports library

Business Benefits:

  • Assembles 50+ monthly reports automatically
  • Ensures consistent report structure and formatting
  • Reduces manual report assembly time by 80%
  • Eliminates errors in report section ordering

Industry Use Cases & Applications

Legal & Professional Services Use Cases

  • Contract Assembly: Combine contract sections into complete legal documents
  • Legal Brief Consolidation: Merge multiple brief sections into comprehensive legal briefs
  • Compliance Documentation: Consolidate compliance documents for regulatory submissions
  • Client Document Assembly: Combine client-specific documents into complete packages

Get Help