Skip to main content

Add Header

Adds a header to a Word document with customizable formatting.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing the node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • In File Descriptor - Unique identifier of the document to add header to. This comes from the Create Word or Open Word node. Default variable is {{$message.word_fd}}.
  • Text - Header text content. This text will appear at the top of the specified pages.

Options

  • Header Type - Determines which pages display the header:
    • All Pages - Header appears on every page (default)
    • First Page - Header appears only on the first page
  • Font Size - Font size for the header text in points. Default is 12.
  • Font Name - Font family name for the header text. Default is "Arial".
  • Bold - Whether to make the header text bold. Default is true.

How It Works

The Add Header node adds formatted text to the header section of the document. When executed, the node:

  1. Validates the file descriptor and header text
  2. Retrieves the document from memory
  3. Iterates through all sections in the document
  4. Configures header settings based on the selected Header Type
  5. Clears any existing header content in the target section
  6. Adds new header text with center alignment
  7. Applies the specified font, size, and bold formatting

Requirements

  • Valid file descriptor from Create Word or Open Word node
  • Non-empty header text
  • Valid font size (positive number)
  • Valid font name

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid file descriptor
  • Document not found
  • Empty header text
  • Invalid font size or font name
  • Runtime errors during header creation

Usage Examples

Example 1: Company Header on All Pages

Scenario: Add a company name header to all pages of a report

// Set company name
$local.companyName = "Acme Corporation - Confidential";

Configuration:

  • In File Descriptor: {{$message.word_fd}}
  • Text: {{$local.companyName}}
  • Header Type: All Pages
  • Font Size: 10
  • Font Name: Arial
  • Bold: true

Result: "Acme Corporation - Confidential" appears centered and bold at the top of every page.

Example 2: Title Page Header

Scenario: Add a special header only to the first page

// Set title page header
$local.titleHeader = "Annual Report 2025";

Configuration:

  • In File Descriptor: {{$message.word_fd}}
  • Text: {{$local.titleHeader}}
  • Header Type: First Page
  • Font Size: 14
  • Font Name: Times New Roman
  • Bold: true

Result: "Annual Report 2025" appears only on the first page, allowing different or no header on subsequent pages.

Example 3: Document Reference Header

Scenario: Add a document reference number with subtle styling

// Set document reference
$local.docRef = "DOC-2025-001 | Version 1.0";

Configuration:

  • In File Descriptor: {{$message.word_fd}}
  • Text: {{$local.docRef}}
  • Header Type: All Pages
  • Font Size: 8
  • Font Name: Calibri
  • Bold: false

Result: Small, non-bold reference number appears at the top of all pages.

Usage Notes

  • Headers are centered by default
  • The node replaces any existing header content in the target sections
  • Headers apply to all sections in the document
  • First Page header type enables different headers for first vs. other pages
  • Headers do not affect the document's main content area
  • Multiple calls to Add Header will replace previous headers

Tips for Effective Use

  1. Professional Sizing: Use smaller font sizes (8-10pt) for headers to avoid overwhelming the page
  2. Consistent Branding: Include company name or logo text in headers
  3. Document Tracking: Add document numbers, versions, or dates in headers
  4. Confidentiality: Use headers to mark confidential or draft documents
  5. First Page Distinction: Use "First Page" type for title pages that need different headers
  6. Font Pairing: Match header font with document body font for consistency
  7. Bold for Emphasis: Use bold for important header information

Best Practices

  • Keep It Concise: Headers should be brief - one or two lines maximum
  • Test Visibility: Ensure header doesn't interfere with page margins
  • Standard Fonts: Use common fonts (Arial, Calibri, Times New Roman) for compatibility
  • Consistent Styling: Use the same header style throughout a document set
  • Consider Footers: For page numbers or additional info, use footer functionality (if available)
  • Date Stamps: Include current date in headers for version tracking

Header Type Scenarios

Header TypeUse CaseExample
All PagesStandard documents, reports, lettersCompany name on all pages
First PageTitle pages, covers, executive summariesReport title on first page only

Common Errors and Solutions

ErrorCauseSolution
"File descriptor cannot be empty"No file descriptor providedEnsure Create Word or Open Word node runs first
"Header text cannot be empty"No text content providedProvide text in the Text input
"Document not found"Invalid file descriptorVerify file descriptor matches the one from Create/Open Word
"Failed to add header to document"Runtime errorCheck all parameters are valid

Font Size Guidelines for Headers

Size (pt)Visual EffectBest Use
8Very smallDocument references, metadata
9SmallConfidential markings, subtle branding
10StandardCompany names, general headers
11MediumEmphasized headers
12LargeProminent headers, titles
14+Very largeCover page headers only

Formatting Examples

Corporate Header

Text: "ACME CORPORATION | INTERNAL USE ONLY"
Font: Arial
Size: 9
Bold: true
Type: All Pages
Text: "Contract Agreement - CONFIDENTIAL"
Font: Times New Roman
Size: 10
Bold: true
Type: All Pages

Report Title Header

Text: "Quarterly Financial Report Q4 2025"
Font: Calibri
Size: 12
Bold: true
Type: First Page

Simple Reference Header

Text: "Doc ID: 2025-RPT-001"
Font: Arial
Size: 8
Bold: false
Type: All Pages

Design Considerations

  1. Margin Space: Headers appear in the top margin - ensure margins are adequate
  2. Page Layout: Headers work with all page orientations (portrait/landscape)
  3. Multi-Section Documents: Headers can differ between sections in complex documents
  4. Printing: Headers appear on printed pages - test print preview
  5. PDF Export: Headers are preserved when saving as PDF
  6. Readability: Ensure header text contrasts well with page background

Advanced Usage Patterns

Dynamic Headers with Variables

// Create dynamic header with date and user
$local.currentDate = new Date().toLocaleDateString();
$local.userName = $env.username;
$local.headerText = `Generated by ${$local.userName} on ${$local.currentDate}`;

Conditional Headers

// Different headers based on document type
if ($local.documentType === "confidential") {
$local.headerText = "CONFIDENTIAL - DO NOT DISTRIBUTE";
} else {
$local.headerText = "Internal Document";
}