Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
These print options allow users to:
Aspose.Cells for Node.js via C++ supports all the print options offered by Microsoft Excel and developers can easily configure these options for worksheets using the properties offered by the PageSetup class. How these properties are used is discussed below in more detail.
By default, the print area incorporates all areas of the worksheet that contain data. Developers can establish a specific print area of the worksheet.
To select a specific print area, use the PageSetup class' PageSetup.getPrintArea() property. Assign a cell range that defines the print area to this property.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Obtaining the reference of the PageSetup of the worksheet
const pageSetup = workbook.getWorksheets().get(0).getPageSetup();
// Specifying the cells range (from A1 cell to T35 cell) of the print area
pageSetup.setPrintArea("A1:T35");
// Save the workbook.
workbook.save(path.join(dataDir, "SetPrintArea_out.xls"));
Aspose.Cells allows you to designate row and column headers to repeat on all pages of a printed worksheet. To do so, use the PageSetup class' PageSetup.getPrintTitleColumns() and PageSetup.getPrintTitleRows() properties.
The rows or columns that will be repeated are defined by passing their row or column numbers. For example, rows are defined as $1:$2 and columns are defined as $A:$B.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Obtaining the reference of the PageSetup of the worksheet
const pageSetup = workbook.getWorksheets().get(0).getPageSetup();
// Defining column numbers A & B as title columns
pageSetup.setPrintTitleColumns("$A:$B");
// Defining row numbers 1 & 2 as title rows
pageSetup.setPrintTitleRows("$1:$2");
// Save the workbook.
workbook.save(path.join(dataDir, "SetPrintTitle_out.xls"));
The PageSetup class also provides several other properties to set general print options as follows:
To set the PageSetup.getPrintComments() and PageSetup.getPrintErrors() properties, Aspose.Cells for Node.js via C++ also provides two enumerations, PrintCommentsType and PrintErrorsType that contain pre-defined values to be assigned to the PageSetup.getPrintComments() and PageSetup.getPrintErrors() properties respectively.
The pre-defined values in the PrintCommentsType enumeration are listed below with their descriptions.
| Print Comments Types | Description |
|---|---|
| PrintInPlace | Specifies to print comments as displayed on the worksheet. |
| PrintNoComments | Specifies not to print comments. |
| PrintSheetEnd | Specifies to print comments at the end of the worksheet. |
The pre-defined values of PrintErrorsType enumeration are listed below with their descriptions.
| Print Errors Types | Description |
|---|---|
| PrintErrorsBlank | Specifies not to print errors. |
| PrintErrorsDash | Specifies to print errors as “–”. |
| PrintErrorsDisplayed | Specifies to print errors as displayed. |
| PrintErrorsNA | Specifies to print errors as “#N/A”. |
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Obtaining the reference of the PageSetup of the worksheet
const pageSetup = workbook.getWorksheets().get(0).getPageSetup();
// Allowing to print gridlines
pageSetup.setPrintGridlines(true);
// Allowing to print row/column headings
pageSetup.setPrintHeadings(true);
// Allowing to print worksheet in black & white mode
pageSetup.setBlackAndWhite(true);
// Allowing to print comments as displayed on worksheet
pageSetup.setPrintComments(AsposeCells.PrintCommentsType.PrintInPlace);
// Allowing to print worksheet with draft quality
pageSetup.setPrintDraft(true);
// Allowing to print cell errors as N/A
pageSetup.setPrintErrors(AsposeCells.PrintErrorsType.PrintErrorsNA);
// Save the workbook.
workbook.save(path.join(dataDir, "OtherPrintOptions_out.xls"));
The PageSetup class provides the PageSetup.getOrder() property that is used to order multiple pages of your worksheet to be printed. There are two possibilities to order the pages as follows.
Aspose.Cells provides an enumeration, PrintOrderType that contains all pre-defined order types.
The pre-defined values of the PrintOrderType enumeration are listed below.
| Print Order Types | Description |
|---|---|
| DownThenOver | Represents printing order as down then over. |
| OverThenDown | Represents printing order as over then down. |
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
// Instantiating a Workbook object
const workbook = new AsposeCells.Workbook();
// Obtaining the reference of the PageSetup of the worksheet
const pageSetup = workbook.getWorksheets().get(0).getPageSetup();
// Setting the printing order of the pages to over then down
pageSetup.setOrder(AsposeCells.PrintOrderType.OverThenDown);
// Save the workbook.
workbook.save(path.join(dataDir, "SetPageOrder_out.xls"));
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.