跳到主要内容

添加图像页眉或页脚 Exceln8n

添加图片页眉/页脚 是一个 PDF4me Excel 操作 n8n 此功能可将徽标或品牌图像插入到 .xlsx 工作簿的页眉或页脚中,位置可选左侧、中间或右侧,并且可以应用于单个工作表或所有工作表。无需打开文件即可将一致的企业品牌应用于生成的报告。 Excel

此节点的功能

PDF4me Excel添加图片页眉/页脚 该功能接受一个源工作簿和一个单独的图像输入,然后将图像放置在页面页眉或页脚的指定水平位置,并可配置页面边距。“目标工作表”功能会将图像应用到指定的工作表(按名称),或者在工作簿留空时应用到整个工作簿。

相关博客文章
目前尚无关于此功能的博客文章——敬请期待。
在此期间,您可以浏览 PDF4me 博客,查看适用于各平台的教程和工作流程。
访问博客

验证您的身份 API 要求

每一个 PDF4me 节点 n8n 需要有效 用于连接的凭证创建或选择一个包含您的 PDF4me API 关键在于确保工作流程能够安全地验证品牌授权请求。

您不容错过的重要事实

两个独立的输入:工作簿和图像
Excel 文件输入法和图像输入法是独立配置的,各自有自己的二进制数据属性名称,因此徽标可以来自与工作簿本身不同的上游节点。
一个切换开关可以选择显示页眉或页脚,不能同时显示两者。
“应用于页眉或页脚”操作每次运行会将图像放置在一个位置。如果要在页眉中放置徽标,在页脚中放置不同的标记,则需要执行两次节点操作。
边距默认值 Excel标准尺寸为 1.9 厘米
上、下、左、右边距的默认值均为 1.9 厘米,与……一致 Excel的页面边距是默认的,因此大多数工作簿根本不需要更改边距。
PDF4me Excel 节点在 n8n 中设置为“添加图像页眉/页脚”操作,Excel 文件输入方式和图像输入方式均来自上一个节点(二进制数据),二进制数据属性名称为 data,图像二进制数据属性名称为 image,启用“应用于页眉或页脚”选项,图像位置居中,目标工作表为 Sheet1,上下左右边距为 1.9,输出文件名为 excel_with_image_header_footer.xlsx

PDF4me Excel 在“添加图像页眉/页脚参数”面板中 n8n

添加图片页眉/页脚需要哪些参数?

必需的: 手术, Excel 文件输入方式、图像输入方式、同时兼容这两种方式的输入字段以及输出文件名。应用于页眉或页脚、图像位置、目标工作表以及四个边距字段均提供可用的默认值。

范围必需的它的作用例子
OperationRequiredSelects the PDF4me Excel action to run. Choose Add Image Header/Footer.Add Image Header/Footer
Excel File Input MethodRequiredHow the workbook reaches the node. From Previous Node (Binary Data) reads it from an upstream item; the dropdown also offers base64 and file URL alternatives.From Previous Node (Binary Data)
Binary Data Property NameConditionalName of the binary property on the incoming n8n item holding the .xlsx workbook. Applies when the input method is binary data. Defaults to data.data
Image Input MethodRequiredHow the image reaches the node, chosen independently of the workbook input. Supports Binary Data, Base64 String, or URL.From Previous Node (Binary Data)
Image Binary Data Property NameConditionalName of the binary property on the incoming n8n item holding the image file. Applies when Image Input Method is binary data.image
Apply to Header or FooterOptionalToggle that places the image in the header when on, or the footer when off. Default true (header).true
Image PositionOptionalHorizontal placement of the image. Left, Center, or Right. Default Center.Center
Target WorksheetsOptionalComma-separated worksheet names to apply the image to. Leave blank to apply it to every worksheet.Sheet1
Top MarginOptionalTop page margin in centimeters. Default 1.9.1.9
Bottom MarginOptionalBottom page margin in centimeters. Default 1.9.1.9
Left MarginOptionalLeft page margin in centimeters. Default 1.9.1.9
Right MarginOptionalRight page margin in centimeters. Default 1.9.1.9
Output File NameRequiredFilename for the branded workbook the node returns. Include the .xlsx extension.excel_with_image_header_footer.xlsx

输出字段

一次成功的运行返回一个 n8n 携带物品 JSON 元数据加上品牌工作簿作为二进制数据。

场地类型它包含什么
successBooleanTrue when the image was applied successfully. Use it to route error-handling branches.
fileNameStringFilename of the branded workbook, matching Output File Name.
fileSizeNumberSize of the returned workbook in bytes.
originalFileNameStringThe filename of the input workbook, echoed back for tracking.
isHeaderBooleanTrue when the image was placed in the header, false when placed in the footer.
positionStringHorizontal alignment applied to the image: Left, Center, or Right.
worksheetNamesArrayWorksheet names the image was applied to.
topMarginNumberTop page margin in centimeters, matching the Top Margin input.
bottomMarginNumberBottom page margin in centimeters, matching the Bottom Margin input.
leftMarginNumberLeft page margin in centimeters, matching the Left Margin input.
rightMarginNumberRight page margin in centimeters, matching the Right Margin input.
messageStringHuman-readable result message for the operation.
Binary (data)BinaryThe branded .xlsx workbook. Pass into Write Binary File, Email, or a cloud-storage upload.

N8N 行动反应

JSON 回复格式

[
{
"fileName": "excel_with_image_header_footer.xlsx",
"fileSize": 221849,
"success": true,
"originalFileName": "myExcelFile.xlsx",
"isHeader": true,
"position": "Center",
"worksheetNames": ["Sheet1"],
"topMargin": 1.9,
"bottomMargin": 1.9,
"leftMargin": 1.9,
"rightMargin": 1.9,
"message": "Image header/footer added to Excel file successfully"
}
]

如何在网页上设置添加图片页眉/页脚? n8n

  1. 添加 PDF4me Excel 将节点添加到您的工作流程并设置 手术添加图片页眉/页脚
  2. 用于连接的凭证请选择您的 PDF4me API 或使用您的凭证创建一个凭证 API 钥匙。
  3. Excel 文件输入法二进制数据属性名称 针对源工作簿。
  4. 图像输入法图像二进制数据属性名称 用于徽标或图片。
  5. 转变 应用于页眉或页脚 开启时显示页眉图片,关闭时显示页脚图片。
  6. 图像位置左边中心, 或者 正确的
  7. 目标工作表或者留空以将图像应用于所有位置,并根据需要调整边距。
  8. 输出文件名 以……结尾 .xlsx执行该节点,并将品牌工作簿路由下去。

典型配置

工作流程示例Common n8n workflow patterns using Add Image Header/Footer for Excel.
每份生成的报告上都会显示公司徽标
  1. 日程触发器会生成每周数据工作簿。
  2. 添加图像页眉/页脚,将公司徽标插入页眉或页脚,并将图像位置设置为右侧。
  3. 这份带有品牌标识的报告将通过电子邮件发送给利益相关者。
客户联合品牌标识应用于交付成果
  1. 工作流程会提取客户的徽标。 URL 一个 CRM 记录。
  2. 图像输入法设置为 URL 因此,徽标直接从该记录加载。
  3. 工作簿的页眉部分会印有客户的品牌标识。
页脚处的批准印章
  1. 当经理在内部工具中签字确认后,审批 webhook 就会触发。
  2. 添加图像页眉/页脚,同时关闭“应用于页眉或页脚”选项,将审批图形放置在页脚中。
  3. 盖章的工作簿已存档。 SharePoint
仅对摘要表进行品牌宣传
  1. 多工作表工作簿包含原始数据标签页和一个汇总表。
  2. 目标工作表设置为汇总,因此原始数据选项卡保持无品牌标识。
  3. 品牌汇总表导出到 PDF 供分发。

实用技巧

Header and footer need separate runs
Apply to Header or Footer only picks one location per execution. Add a second node for the other placement.
Image and workbook inputs are independent
Image Input Method does not have to match Excel File Input Method. A logo can come from a public URL while the workbook comes from binary data.
Target Worksheets is comma-separated
List multiple sheet names like Sheet1,Summary to brand several sheets at once, or leave it blank for the whole workbook.
Margins are in centimeters, not inches
The 1.9 default matches Excel's standard margin in centimeters. Adjust with that unit in mind when nudging image placement.
Output File Name needs the .xlsx extension
Omitting it can leave downstream nodes unable to detect the format when writing or emailing the file.
Use a transparent PNG for a cleaner look
A transparent-background logo blends into the page better than a solid rectangle, especially over shaded header rows.

速查表

场地价值
OperationAdd Image Header/Footer
Excel File Input MethodFrom Previous Node (Binary Data)
Binary Data Property Namedata
Image Input MethodFrom Previous Node (Binary Data)
Image Binary Data Property Nameimage
Apply to Header or Footeron (header)
Image PositionCenter
Target WorksheetsSheet1 (blank for all)
Top / Bottom / Left / Right Margin1.9 cm each
Output File Nameexcel_with_image_header_footer.xlsx
CredentialsPDF4me API credential

常见问题

Does the toggle add the image to the header or the footer?+
Apply to Header or Footer is a single toggle that switches placement between the two. Switched on, the image goes into the header; switched off, it goes into the footer. The response echoes the placement back as isHeader true or false.
What happens if Target Worksheets is left empty?+
The image is applied to every worksheet in the workbook. Entering one or more comma-separated sheet names restricts the image to those sheets only, and the response lists them back in worksheetNames.
Can I place a logo in the header and a different image in the footer?+
Yes, but not in one execution. Run the Add Image Header/Footer operation twice in the same workflow, once with Apply to Header or Footer switched on for the header image and once switched off for the footer image.
What units are the margin fields in?+
Top Margin, Bottom Margin, Left Margin, and Right Margin are all in centimeters and default to 1.9, matching Excel's standard page margin. Increase a margin to push the image further from the page edge.
Which image formats does Image Input Method accept?+
Common raster formats such as PNG, JPG, JPEG, and GIF are supported, supplied through Binary Data, a Base64 String, or a public URL, the same input pattern used throughout n8n's integrations for binary data.

相关操作

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

获取帮助