Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Page setup settings also provide several Print Options (also referred to as Sheet Options) that allow users to control the printed pages of worksheets. These print options allow users to:
Setting Print/Sheet Options
Aspose.Cells supports all of these print options and developers can easily configure them for their desired worksheets using several properties offered by the PageSetup class. The usage of these properties of the PageSetup class is discussed in more detail below.
By default, the print area selected encompasses the entire worksheet that contains data. However, developers can also specify a specific print area as needed.
To select a specific print area, developers can set the PrintArea property of the PageSetup class. You can provide the cell range of the print area as a string.
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the PageSetup of the worksheet
PageSetup pageSetup = workbook.Worksheets[0].PageSetup;
//Specifying the cells range (from A1 cell to T35 cell) of the print area
pageSetup.PrintArea = "A1:T35";
Aspose.Cells allows you to designate row and column headers that you want to have repeated on all pages of your printed worksheet. To do so, developers can set PrintTitleColumns and PrintTitleRows properties of the PageSetup class.
The rows or columns (to be repeated on all pages of the printed worksheet) are defined by passing their row or column numbers. For example, rows are defined as $1:$2 and columns are defined as $A:$B.
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the PageSetup of the worksheet
Aspose.Cells.PageSetup pageSetup = workbook.Worksheets[0].PageSetup;
//Defining column numbers A & B as title columns
pageSetup.PrintTitleColumns = "$A:$B";
//Defining row numbers 1 & 2 as title rows
pageSetup.PrintTitleRows = "$1:$2";
PageSetup class also provides several other methods to set general print options as follows:
To use the PrintComments and PrintErrors properties, Aspose.Cells provides two enumerations, PrintCommentsType and PrintErrorsType, that contain predefined values to be passed as parameters.
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the PageSetup of the worksheet
PageSetup pageSetup = workbook.Worksheets[0].PageSetup;
//Allowing to print gridlines
pageSetup.PrintGridlines = true;
//Allowing to print row/column headings
pageSetup.PrintHeadings = true;
//Allowing to print worksheet in black & white mode
pageSetup.BlackAndWhite = true;
//Allowing to print comments as displayed on worksheet
pageSetup.PrintComments = PrintCommentsType.PrintInPlace;
//Allowing to print worksheet with draft quality
pageSetup.PrintDraft = true;
//Allowing to print cell errors as N/A
pageSetup.PrintErrors = PrintErrorsType.PrintErrorsNA;
PageSetup class provides the Order property that is used to set the order of 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 predefined order types to be assigned to the Order property.
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Obtaining the reference of the PageSetup of the worksheet
PageSetup pageSetup = workbook.Worksheets[0].PageSetup;
//Setting the printing order of the pages to over then down
pageSetup.Order = PrintOrderType.OverThenDown;
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.