跳到主要内容

在“生成单个文档”中 Power Automate

此操作的作用

PDF4me 生成单个文档 合并一个单词, HTML, 或者 PDF 带有模板 JSON 或者 XML 数据内部 Power Automate 流程并生成个性化 PDFWord、Excel 或 HTML 一次性完成文件处理,取代了多步骤操作。 Microsoft 365 只需一个可配置步骤即可实现邮件合并流程。映射来自任何位置的模板文件。 Microsoft 365 存储操作(SharePointOneDrive数据宇宙 Outlook (例如,通过附件),从动态内容或映射文件中提供数据,并将生成的数据通过管道传输。 文件日期 直接执行创建文件、发送电子邮件或任何后续操作。

相关博客文章(1)

验证您的身份 API 要求

PDF4me 将连接器连接到 Power Automate 需要有效 联系 握着你的 PDF4me API 关键在于:在流程设计时创建一次连接,然后每次都创建连接。 PDF4me 租户中的操作会重用它。

您不容错过的重要事实

模板文件类型必须与模板扩展名匹配。
模板文件类型下拉菜单(PDF4me Word模板 PDF4me HTML 模板, PDF4me PDF 模板)必须与模板下映射的文件匹配。一个 .docx 文件映射为 HTML 选择的类型在运行时失败。Word 模板使用类似“胡子”的占位符,例如: {{customer.name}}
提供文档数据文本或文档数据文件
文档数据文本接受内联 JSON 或者 XML 由动态内容构建。文档数据文件接受来自先前版本的二进制数据文件。 Microsoft 365 步骤。在每个流程中,提供其中之一,而不是两者都提供。
文档数据是动态内容输出
生成的文件显示为 文件日期 动态内容字段。直接将其传递到 SharePoint 创建文件, Outlook 发送一封带有附件的电子邮件 OneDrive 创建文件,Dataverse 添加新行,或 Teams 发布包含文件的消息。
在 Power Automate 流中配置了 PDF4me 生成文档单次操作,模板文件类型设置为 PDF4me Word 模板,输出类型设置为 PDF,并映射了 SharePoint 中的 Word 模板。

在“生成单个文档”操作中 Power Automate 流程。模板文件类型、输出类型、模板名称、模板、文档数据类型和文档数据文本(或文档数据文件)是典型的 Word 转文档流程所需的字段。PDF 跑步。

参数

必需的: 模板文件类型、输出类型、模板名称、模板、文档数据类型。 条件: 文档数据文本或文档数据文件(两者之一必须承载数据有效载荷)。 选修的: 元数据 JSON。

范围必需的它的作用例子
Template File TypeYesFormat of the template file. PDF4me Word Template (.docx, mustache template variables, most common), PDF4me HTML Template (.html), or PDF4me PDF Template (.pdf, form field replacement).PDF4me Word Template
Output TypeYesFormat of the generated document. Word (editable .docx), PDF (locked layout, most common), Excel (.xlsx), or HTML.PDF
Template NameYesFilename of the template including extension. Map as dynamic content from the prior step File Name output (SharePoint, OneDrive, Outlook attachments).invoice_template.docx
TemplateYesBinary content of the template file. Map as dynamic content from the prior step File Content output (SharePoint Get file content, OneDrive Get file content, Outlook Get attachments).@triggerOutputs()?['body']
Document Data FileConditionalBinary data file produced by an upstream step. Use when the data lives in a file (SharePoint json file, OneDrive xml file). Required when Document Data Text is not provided.@outputs('Get_data_file')?['body']
Document DataTypeYesFormat of the data payload. Json (most common in Power Automate, maps cleanly from SharePoint columns and Forms) or Xml (for XML-native source systems).Json
Document Data TextConditionalInline data payload built from dynamic content. Use for short JSON or XML built with Power Automate expressions. Required when Document Data File is not provided.{ "Name": "John", "Age": 16, "Birth": "2000-1-1" }
Meta Data JsonNoOptional document properties as a JSON object (title, author, subject, custom fields) for templates that reference metadata at render time. Leave empty for most invoice and contract templates.{"title":"Invoice 2024-100"}

模板文件类型选项

PDF4me Word模板带有胡子占位符的 .docx
最灵活的选项。支持占位符,例如 {{customer.name}}支持循环、条件语句、表格和内嵌图片。最适合在 Word 中创建发票、合同、证书和信函。
PDF4me HTML模板带有内联 CSS 的 .html 文件
当您的团队维护电子邮件或网页模板时,可以使用此功能。对市场营销很有帮助。 PDFs 和品牌风格的发票由现有发票生成 HTML
PDF4me PDF模板可填写 PDF 表单字段替换
当您拥有固定布局的可填充表单时,请使用此方法。 PDF (政府、监管机构或合规表格)。此操作会将您的数据填充到指定的表单字段中,并返回填充后的结果。 PDF

输出类型选项

PDFPrint-ready locked layout
Standard choice for invoices, contracts, certificates, and statements. Attach to an Outlook email, save to a SharePoint document library, or store in a Dataverse file column.
WordEditable .docx output
Use when recipients need to edit the document (draft contracts going back for review, HR letters requiring a manual signature line).
ExcelSpreadsheet .xlsx output
Use for data-heavy templates such as financial reports. The template must be designed in Excel.
HTMLWeb-ready HTML
Use for emails or web previews. Output is a single HTML file you can embed or send through Outlook.

输出

该操作返回一个动态内容包。生成的文件保存在…… 文件日期准备进入下游 Microsoft 365 行动。

场地类型它包含什么
Doc DataBinaryThe generated document in the format chosen under Output Type. Pass directly into SharePoint Create file, Outlook Send an email with attachment, OneDrive Create file, Dataverse Add a new row, or Teams Post a message.
File NameStringOutput filename based on Template Name with the extension matching Output Type.

流程示例

常见的 Power Automate 流程模式Typical ways to chain Generate Document Single into a flow.
SharePoint 列表到电子邮件 PDF
  1. SharePoint 当发票列表中创建或修改项目时,会触发该触发器。
  2. SharePoint 获取文件内容会从模板库中加载发票 Word 模板。
  3. 生成包含列表项列的文档单合并模板 JSON输出类型 PDF
  4. Outlook 向客户发送一封包含感谢信息的电子邮件,邮件正文附有文档数据。
表格回复证书
  1. Microsoft Forms 当提交新回复时,会触发课程完成事件。
  2. OneDrive 获取文件内容,加载证书 Word 模板。
  3. 生成单个文档会将证书渲染为 PDF 使用表单响应作为 JSON
  4. SharePoint 创建文件会将证书存储在证书文档库中,并且 Outlook 发送电子邮件即可将其发送给学生。
Dataverse 合同需经 Teams 批准
  1. Dataverse 当向 Deals 中添加一行时,会在已成交的商机上触发触发器。
  2. SharePoint 获取文件内容,加载合同模板。
  3. 生成单个文档以生成合同 PDF 来自交易数据。
  4. Teams Post 自适应卡片,带有审批路线,将文档数据发送给法律所有者进行签字确认。

常见问题解答

What template file types does Generate Document Single accept in Power Automate?+
Three options under Template File Type: PDF4me Word Template (.docx with mustache template variables, most common), PDF4me HTML Template (.html for browser-rendered layouts), and PDF4me PDF Template (.pdf for form field replacement on a fillable PDF). Match the type to the extension of the file mapped under Template.
What output formats can the action produce?+
Output Type supports Word (.docx for editable output), PDF (locked layout, most common for invoices and contracts), Excel (.xlsx for spreadsheet output), and HTML for web embedding. The output format is independent of the template type, so a Word template can produce a PDF and vice versa.
How do I pass JSON data to the template in a flow?+
Set Document DataType to Json, then either paste the JSON object directly into Document Data Text (with dynamic content expressions for SharePoint columns or Forms responses) or map a data file from a previous step into Document Data File. Document Data Text is best for short payloads built inline, Document Data File for larger pre-built data documents.
Where does the generated file appear in dynamic content?+
The output is on the Doc Data dynamic-content field of the action. Pass Doc Data into SharePoint Create file, Outlook Send an email with attachment, OneDrive Create file, Dataverse Add a new row with file column, or Teams Post a message with file. The filename uses Template Name with the extension matching Output Type.
Does this work with Power Automate Desktop or only Power Automate (cloud)?+
The PDF4me Connect connector is a cloud connector available in Power Automate (the web flow designer). For desktop automation, call the same Generate Document Single REST endpoint with the HTTP action.
Can I generate multiple documents in a loop?+
Yes. Wrap Generate Document Single in an Apply to each loop over an array of records (Dataverse rows, SharePoint list items, Forms responses). The action runs once per record and returns one file per iteration. For true multi-record output in a single call use Generate Documents Multiple.
Is Meta Data Json required?+
No. Meta Data Json is optional. Use it when your template references document metadata (title, author, subject) at render time. Leave it empty for most invoice and contract templates.
How is this different from the Make, n8n, or Zapier version?+
All four platforms call the same PDF4me Generate Document Single backend. Power Automate is the Microsoft 365 native option with built-in SharePoint, Outlook, Teams, and Dataverse connectors. Make is the visual scenario builder, n8n is the developer-friendly self-hosted option, Zapier triggers from any of 6,000+ SaaS apps. The template logic and output formats are identical across platforms.

相关行动

在其他平台上执行相同的任务

获取帮助