跳到主要内容

产生 PDFWord 模板 Make

本指南涵盖的内容

本指南将引导您完成构建过程。 Make 产生以下情况的场景 PDF 来自一份文件 Word 模板和 JSON 使用数据文件 PDF4me 生成文档这套四模块流程会下载您的 .docx 来自模板和数据文件的 Dropbox将它们合并在一起,然后上传最终结果。 PDF 回归云存储,全程自动化,无需编写任何代码。同样的模式也适用于发票、证书、合同、报告以及您目前手动填写的任何其他文档。

开始之前

A Word 带有合并标签的模板
你的 .docx 文件 <<fieldName>> 动态内容将显示在此处的占位符。下载示例模板,即可在创建自己的模板之前查看预期格式。
A JSON 与模板字段匹配的数据文件
A .json 包含键值对的文件,其中每个键都匹配一个 <<fieldName>> 在模板中添加标签。下载示例数据以验证结构,然后再使用您自己的有效负载。
A PDF4me API 钥匙和 Make 帐户
你需要一个 PDF4me API 用于验证生成文档模块的密钥 Make免费领取一个 PDF4me 仪表盘上,同一个按键适用于所有设备。 PDF4me 在所有场景中都使用模块。

概览

完整版 Make 场景 Word 模板文档生成过程如下:

创建一个名为“生成发票”的场景,其中包含四个相互连接的模块:Dropbox 1(下载文件,带有定时触发时钟图标)、Dropbox 2(下载文件)、PDF4me 3(生成文档)和 Dropbox 4(上传文件)。

完整流程: 下载模板下载数据PDF4me 生成文档上传输出 PDF

四个模块,依次为:

模块目的
1Dropbox下载文件取回 .docx Word 模板文件
2Dropbox下载文件取回 .json 数据文件
3PDF4me生成文档将数据合并到模板中,输出 PDF
4Dropbox上传文件保存已完成的内容 PDF 输出文件夹

第一步:创建您的 Word 模板

使用 PDF4me LINQ 报表引擎 标签语法在你的 Word 文档:

<<fieldName>> → simple text substitution
<<foreach [item in items]>>
<<[item.name]>> → loop over array items
<</foreach>>
<<if [condition]>>
content → conditional section
<</if>>

发票模板示例摘录:

Invoice No: <<[invoiceNumber]>>
Date: <<[invoiceDate]:"MMMM dd, yyyy">>
Customer: <<[customerName]>>

<<foreach [line in lineItems]>>
<<[line.description]>> Qty: <<[line.qty]>> $<<[line.price]:"F2">>
<</foreach>>

Total: $<<[total]:"F2">>

将文件另存为 .docx 并将其上传到您的 Dropbox (或者 Google Drive / OneDrive)在一个文件夹中 Make 例如,可以访问 /pdf4metest/GenerateDocumentFromWord/invoice_template.docx

匹配 JSON 数据:

{
"invoiceNumber": "INV-2026-00123",
"invoiceDate": "2026-05-10",
"customerName": "Acme Corporation",
"lineItems": [
{ "description": "PDF Automation Setup", "qty": 1, "price": 1200.00 },
{ "description": "API Integration", "qty": 3, "price": 450.00 }
],
"total": 2550.00
}

有关完整的模板标签参考,请参阅 Word 模板语法指南

步骤 2:设置两个下载步骤 Make

加两个 Dropbox下载文件 在开始之前,请按照以下步骤说明您的场景 PDF4me 模块。

Dropbox 下载文件模块显示连接 YnooxTestone,文件选择方式设置为“选择文件”,文件路径设置为 pdf4metest / GenerateDocumentFromWord / invoice_template.docx

步骤 1(模板): 连接到 Dropbox 并选择 .docx 模板文件。 步骤 2(数据): 对……也做同样的操作。 .json 文件夹中的数据文件。

对于每个 Dropbox 下载步骤:

  1. 点击 联系 → 选择或添加您的 Dropbox 联系。
  2. 文件选择方式选择文件
  3. 浏览到您的文件(例如: /pdf4metest/GenerateDocumentFromWord/invoice_template.docx 对于步骤 1,以及 .json 步骤 2 的路径)。
  4. 点击 好的 确认选择。

Data 每一步的输出都是你要连接到的二进制文件内容。 PDF4me 模块。

步骤 3:配置 PDF4me 生成文档

添加 PDF4me生成文档 完成两个下载步骤后。

PDF4me 生成文档模块显示连接 TestUser01 Prod,模板文件类型下拉菜单设置为 Word,并提示“选择模板文件类型”,输出类型下拉菜单设置为 PDF,文件部分包含单选按钮“Dropbox 下载文件”(已选择两次)和“映射”选项,文档数据类型下拉菜单设置为 JSON,并提示“选择文档数据类型”。

模板文件类型Word输出类型Pdf将两者连接起来 Dropbox 步骤如下:模板和数据文件输入 文件

配置:

场地价值笔记
联系你的 PDF4me 联系点击“添加”→粘贴 API 如果是第一次
模板文件类型Word与您的匹配 .docx 模板
输出类型Pdf或者 Word / Excel 如有需要
文件Dropbox下载文件(×2)第一行 = 模板,第二行 = 数据文件
文档数据类型Json或者 Xml 如果你的数据文件是 XML
文档数据文本(如果使用文件,请留空)或者粘贴 JSON 直接在这里
元数据 JSON(选修的)日期格式设置,复选框 HTML 字段

该模块输出 文件日期 (已完成) PDF 二进制)和 姓名 (输出文件名):两者均可在下一步中进行映射。

步骤 4:保存输出 PDF

添加一个 Dropbox上传文件 作为最后一个模块的步骤。

Dropbox 文件上传模块,可配置目标文件夹和文件名。

地图 文件日期PDF4me 设置文件内容,并设置目标文件夹和文件名。

配置:

  • 文件夹路径 → 你的输出文件夹,例如: /pdf4metest/GeneratedInvoices/
  • 文件名 → 绘制地图 Name 输出 PDF4me或者使用动态表达式,例如 Invoice_{{timestamp}}.pdf
  • 文件 (或者 文件内容) → 地图 文件日期PDF4me 生成文档步骤

点击 运行一次 测试完整流程。打开目标文件夹以确认。 PDF 已正确生成并保存。

工作流程示例

现实世界场景变化Common document types you can generate with this same four-step pattern.
新订单的发票生成
  1. 当有新订单生成时,会触发一个 webhook。 Shopify 或者 WooCommerce
  2. 订单有效负载(客户、订单项、总计)被组装成 JSONMake 文本模块。
  3. Google Drive 下载发票 Word 团队网盘中的模板。
  4. 生成文档 合并订单 JSON 将内容输入模板并输出一个 PDF
  5. Gmail 发送发票 PDF 发送给客户并将副本上传到 SharePoint “发票”库。
课程结业证书
  1. A Typeform 完成调查后,系统会触发包含参与者姓名、课程和日期的场景。
  2. Dropbox 下载证书 Word 模板。
  3. 生成文档 填写参与者姓名、课程名称和完成日期,输出类型 Pdf
  4. Gmail 发送证书 PDF 对参与者而言。
  5. 证书上传到 SharePoint 用于合规记录的“认证”库。
每周报告,数据来自谷歌表格
  1. 每周一都会触发一个预定场景,并读取上周的关键绩效指标 (KPI)。 Google Sheets
  2. A Make 文本模块将表格数据组装成一个 JSON 与报表模板字段匹配的对象。
  3. Dropbox 下载报告 Word 模板。
  4. 生成文档 合并 JSON 在模板中,输出类型 Word 这样团队在分发报告之前仍然可以对其进行编辑。
  5. 生成的 Word 在上午 9 点站会之前,将文件邮件发送给管理团队。

常见问题解答

What merge tag syntax does the Word template use?+
PDF4me uses the LINQ Reporting Engine syntax. Wrap field names in double angle brackets: <<fieldName>> for simple substitution, <<foreach [item in items]>> ... <</foreach>> for repeating sections like invoice line items, and <<if [condition]>> ... <</if>> for conditional content. Apply .NET format strings for output formatting: <<[invoiceDate]:"MMMM dd, yyyy">> for dates, <<[total]:"F2">> for two decimal places. Download the sample template linked above to see working examples before building your own.
Can I use Google Drive or OneDrive instead of Dropbox?+
Yes: any cloud storage connector in Make works as the download source for both the template and data files. Replace the Dropbox steps with Google Drive, Download a File, OneDrive, Get file content, SharePoint, Get file content, or HTTP, Make a request steps. The PDF4me Generate Document module only requires the binary file content and filename, it does not care which connector provides them. The final upload step can similarly use any storage connector supported by Make.
Does the data have to be a file, or can I build the JSON inside Make?+
Both work. This guide downloads a pre-built JSON file for clarity, but you can also construct the JSON string inside Make. Use a Set Variable step, a Text Aggregator, or a Make native function to build a JSON string from prior module outputs: for example, from a webhook payload, a Google Sheets row, or an API response. Map the resulting string to the Document Data Text field in Generate Document instead of using Document Data File.
What output formats are supported?+
The Generate Document module supports three Output Type values: Pdf (most common, for final delivery and archiving), Word (returns a merged .docx for further editing before sending), and Excel (converts the merged content to a spreadsheet). The Template File Type must match the actual format of your template file: Word for .docx templates, html for HTML templates. You can combine any template type with any output type: an HTML template can still produce a PDF or Word output.
How do I handle dates, checkboxes, and HTML content in template fields?+
Use the Meta Data Json parameter in the Generate Document module. For date fields, set FieldType to 2 with a FieldFormat string matching your input date format (e.g. "yyyyMMdd"). For checkbox fields that should render as ticks or empty boxes, set FieldType to 0. For fields containing raw HTML that should be rendered as formatted content inside the document, set FieldType to 1. The full structure is: {"FieldsMetaData":[{"FieldName":"dueDate","FieldType":2,"FieldFormat":"yyyyMMdd"},{"FieldName":"approved","FieldType":0}]}.

相关指南

获取帮助