Настройка различных заголовков и колонтитулов для разных страниц с помощью Node.js через C++
Contents
[
Hide
]
MS Excel поддерживает установку различных заголовков и нижних колонтитулов для первой страницы, нечетных страниц и четных страниц, начиная с Excel 2007.
Aspose.Cells for Node.js via C++ поддерживает такую же функцию.
Установка разных заголовков и нижних колонтитулов в MS Excel
- Нажмите Разметка страницы > Печать заголовков > Заголовок/нижний колонтитул.
- Установите флаги Different Odd and Even Pages или Different first page.
- Введите разные заголовки и нижние колонтитулы.
Настройка различных заголовков и колонтитулов с помощью 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.");