Skip to main content

Add Text Header Footer - Excel API

PDF4me Add Text Header Footer enables you to add customizable text headers and footers to Excel documents with comprehensive formatting control. This API service processes Excel files and adds text to header or footer sections with font styling (family, size, color), transparency levels, rotation angles, and orientation options (horizontal, vertical, diagonal, upside-down). The API receives Excel document content through REST API calls, utilizing Base64 encoding for secure transmission. This solution is ideal for document branding, page numbers, dates, and professional presentation workflows.

Authenticating Your API Request

Include your API key in the request to authenticate with the PDF4me REST API.

Key Features

  • Custom Text Content: Add any text as header or footer on Excel documents
  • Font Customization: Control font family, size, color, and specific font names
  • Transparency Control: Set semi-transparent (50% opacity) or fully opaque (100%) text
  • Rotation & Orientation: Apply rotation angles or preset orientations (horizontal, vertical, diagonal, upside-down)
  • Culture Support: Specify culture codes for proper text rendering and formatting

REST API Endpoint

  • Method: POST
  • Endpoint: office/ApiV2Excel/ExcelAddTextHeaderFooter

REST API Parameters

Important: Parameters marked with an asterisk (*) are required. All requests use document, docContent, and one action object. Operation-specific parameters are properties of addTextHeaderFooterToExcelAction.

Required Parameters (root level)

ParameterTypeDescriptionExample
document*ObjectDocument reference. Must contain Name (string) — Excel file name with .xlsx or .xls extension{ "Name": "data.xlsx" }
docContent*String (Base64)Excel document content encoded in Base64UEsDBBQABgAIAAAA...
addTextHeaderFooterToExcelAction*ObjectAction configuration. Must contain at least watermarkText (string) — text to display as header or footerSee Payload example below

Optional Parameters (inside addTextHeaderFooterToExcelAction)

ParameterTypeDescriptionExample
fontFamilyStringFont family name (e.g., Arial, Times New Roman). Default: ArialArial
fontSizeNumberFont size in points (8–72). Default: 7212
fontColorStringHex color code or color name. Default: black#0000FF
semiTransparentBooleantrue = 50% opacity, false = 100% (default)false
rotationNumberRotation angle in degrees (0–360). Default: 045
fontNameStringSpecific font name (overrides fontFamily)Arial Bold
orientationStringHorizontal, Vertical, Diagonal, or Upside-Down. Takes priority over rotationHorizontal
cultureNameStringCulture code for text rendering (e.g., "en-US", "de-DE")en-US

Output

The API returns the Excel document as a Base64-encoded string in JSON format.

Status Code: 200 OK

Response Body:

{
"document": "UEsDBBQABgAIAAAA...",
"fileName": "data.xlsx",
"success": true,
"errorMessage": null
}

Request Example

Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY

Payload (Basic)

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"addTextHeaderFooterToExcelAction": {
"watermarkText": "Confidential Report 2024"
}
}

Payload (With optional formatting)

{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"addTextHeaderFooterToExcelAction": {
"watermarkText": "Confidential Report 2024",
"fontFamily": "Arial",
"fontSize": 12,
"fontColor": "#0000FF",
"orientation": "Horizontal"
}
}

Code Samples

Get Help