Node.jsをC++経由で使用して、異なるページに異なるヘッダーとフッターを設定する方法

MS Excelで異なるヘッダーとフッターの設定

異なるヘッダーとフッターの設定

  1. ページレイアウト > 印刷タイトル > ヘッダー/フッターをクリックします。
  2. 奇数ページと偶数ページを異なる設定にするまたは最初のページだけ異なる設定にするを確認してください。
  3. 異なるヘッダーとフッターを入力します。

Aspose.Cells for Node.js via C++を使用した異なるヘッダーとフッターの設定例

Aspose.CellsはExcelと同じように動作します。

  1. PageSetup.isHFDiffOddEven()PageSetup.isHFDiffFirst()のフラグを設定します。
  2. 異なるヘッダーとフッターを入力します。
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.");