テキストヘッダー/フッターを追加 - Excel API
PDF4me テキストヘッダーとフッターを追加 カスタマイズ可能なテキストヘッダーとフッターを追加できます Excel 包括的な書式設定制御を備えたドキュメント。 API サービスプロセス Excel ファイルを開き、フォントスタイル(ファミリー、サイズ、色)、透明度、回転角度、および方向オプション(水平、垂直、斜め、上下逆)を使用して、ヘッダーまたはフッターセクションにテキストを追加します。 API 受け取る Excel ドキュメントコンテンツ REST API 通話を利用して Base64 安全なデータ送信のためのエンコード。このソリューションは、文書のブランディング、ページ番号、日付の表示、プロフェッショナルなプレゼンテーションワークフローに最適です。
関連ブログ記事
この機能に関するブログ記事はまだありません。近日公開予定です。
その間、PDF4me ブログを閲覧して、あらゆるプラットフォームのチュートリアルやワークフローをご覧ください。
ブログをご覧ください →
認証 API リクエスト
あなたの API 認証リクエストにキーを入力してください PDF4me REST API。
主な機能
- カスタムテキストコンテンツ: ヘッダーまたはフッターとして任意のテキストを追加します Excel 文書
- フォントのカスタマイズフォントの種類、サイズ、色、および特定のフォント名を制御します。
- 透明性管理テキストを半透明(不透明度50%)または完全不透明(100%)に設定します。
- 回転と向き回転角度またはプリセットされた向き(水平、垂直、斜め、上下逆)を適用する
- 文化支援: テキストの適切な表示と書式設定のために、カルチャコードを指定します。
REST API 終点
- 方法: POST
- 終点:
office/ApiV2Excel/ExcelAddTextHeaderFooter
REST API パラメータ
重要: アスタリスク (*) が付いているパラメータは必須です。すべてのリクエストで使用されます。 書類、 ドキュメントコンテンツ、および 1 つのアクション オブジェクト。操作固有のパラメーターは、のプロパティです。 addTextHeaderFooterToExcelAction。
必須パラメータ(ルートレベル)
| パラメータ | 必須 | その機能 | 例 |
|---|---|---|---|
| document | Required | Source file. `Name` must end in `.xlsx`, `.xls` or `.xlsm` (a `.csv` for `ExcelParseCsv`). | { "Name": "data.xlsx" } |
| document.Name | Required | File name including its extension. Type: string. | { "Name": "data.xlsx" } |
| docContent | Required | The source file, base64-encoded. Type: string. | UEsDBBQABgAIAAAA... |
| isAsync | Optional | Process the request in the background. The call returns `202 Accepted`; poll the `Location` URL (`GetActionStatus`) for the result. Type: boolean. | |
| addTextHeaderFooterToExcelAction | Required | Object carrying this operation's settings. Its fields are the addTextHeaderFooterToExcelAction rows below. | See Payload example below |
| addTextHeaderFooterToExcelAction.headerLeft | Optional | Text for the header left section. Type: string. | |
| addTextHeaderFooterToExcelAction.headerCenter | Optional | Text for the header center section. Type: string. | |
| addTextHeaderFooterToExcelAction.headerRight | Optional | Text for the header right section. Type: string. | |
| addTextHeaderFooterToExcelAction.footerLeft | Optional | Text for the footer left section. Type: string. | |
| addTextHeaderFooterToExcelAction.footerCenter | Optional | Text for the footer center section. Type: string. | |
| addTextHeaderFooterToExcelAction.footerRight | Optional | Text for the footer right section. Type: string. | |
| addTextHeaderFooterToExcelAction.headerLeftColor | Optional | Text color. Type: string. | |
| addTextHeaderFooterToExcelAction.headerCenterColor | Optional | Text color. Type: string. | |
| addTextHeaderFooterToExcelAction.headerRightColor | Optional | Text color. Type: string. | |
| addTextHeaderFooterToExcelAction.footerLeftColor | Optional | Text color. Type: string. | |
| addTextHeaderFooterToExcelAction.footerCenterColor | Optional | Text color. Type: string. | |
| addTextHeaderFooterToExcelAction.footerRightColor | Optional | Text color. Type: string. | |
| addTextHeaderFooterToExcelAction.headerLeftFontSize | Optional | Font size. Type: integer. | |
| addTextHeaderFooterToExcelAction.headerCenterFontSize | Optional | Font size. Type: integer. | |
| addTextHeaderFooterToExcelAction.headerRightFontSize | Optional | Font size. Type: integer. | |
| addTextHeaderFooterToExcelAction.footerLeftFontSize | Optional | Font size. Type: integer. | |
| addTextHeaderFooterToExcelAction.footerCenterFontSize | Optional | Font size. Type: integer. | |
| addTextHeaderFooterToExcelAction.footerRightFontSize | Optional | Font size. Type: integer. | |
| addTextHeaderFooterToExcelAction.worksheetNames | Optional | Comma-separated worksheet names. Type: string. | |
| addTextHeaderFooterToExcelAction.worksheetIndexes | Optional | Comma-separated 1-based worksheet numbers, e.g. `"1,3"`. Type: string. | |
出力
の API 返します Excel ドキュメントとして Base64-エンコードされた文字列 JSON フォーマット。
- Success Response
- Error Responses
ステータスコード: 200 OK
応答本文:
{
"document": "UEsDBBQABgAIAAAA...",
"fileName": "data.xlsx",
"success": true,
"errorMessage": null
}
400 Bad Request: 無効なパラメータ、必須フィールドの欠落、無効な Base64 または文書。 401 Unauthorized無効または欠落しています API 鍵。 500 Internal Server Errorサーバー側の処理エラーが発生しました。
リクエスト例
ヘッダ
Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY
ペイロード(基本)
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"addTextHeaderFooterToExcelAction": {
"watermarkText": "Confidential Report 2024"
}
}
ペイロード(オプションの書式設定を含む)
{
"document": { "Name": "data.xlsx" },
"docContent": "UEsDBBQABgAIAAAA...",
"addTextHeaderFooterToExcelAction": {
"watermarkText": "Confidential Report 2024",
"fontFamily": "Arial",
"fontSize": 12,
"fontColor": "#0000FF",
"orientation": "Horizontal"
}
}
コードサンプル
- GitHub