Node.jsをC++経由で使用して、異なるページに異なるヘッダーとフッターを設定する方法
Contents
[
Hide
]
MS Excelは、Excel 2007以降、最初のページ、奇数ページ、偶数ページの異なるヘッダーとフッターの設定をサポートしています。
Aspose.Cells for Node.js via C++も同じ機能をサポートしています。
MS Excelで異なるヘッダーとフッターの設定
- ページレイアウト > 印刷タイトル > ヘッダー/フッターをクリックします。
- 奇数ページと偶数ページを異なる設定にするまたは最初のページだけ異なる設定にするを確認してください。
- 異なるヘッダーとフッターを入力します。
Aspose.Cells for Node.js via C++を使用した異なるヘッダーとフッターの設定例
Aspose.CellsはExcelと同じように動作します。
- PageSetup.isHFDiffOddEven()とPageSetup.isHFDiffFirst()のフラグを設定します。
- 異なるヘッダーとフッターを入力します。
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Loads the workbook which contains hidden external links
const wb = new AsposeCells.Workbook(filePath);
// Gets the setting of page setup.
const pageSetup = wb.getWorksheets().get(0).getPageSetup();
// Sets different odd and even pages
pageSetup.setIsHFDiffOddEven(true);
pageSetup.setHeader(1, "I am the header of the Odd page.");
pageSetup.setEvenHeader(1, "I am the header of the Even page.");
// Sets different first page
pageSetup.setIsHFDiffFirst(true);
pageSetup.setFirstPageHeader(1, "I am the header of the First page.");