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 as Sheet Options ) that allow users to control their printed pages of worksheets. These print options allow users to:
Aspose.Cells supports all of these print options and developers can easily configure these options for their desired worksheets using the several properties offered by PageSetup class. The usage of these properties of PageSetup class is discussed below in more detail.
By default, only that print area is selected that incorporates the entire area of the worksheet, which contains data but developers can also establish a specific print area of the worksheet according to their desire.
To select a specific print area, developers can use set PrintArea method of the PageSetup class. You can provide the cells range of the print area to this method as argument.
//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 use set PrintTitleColumns and setPrintTitleRows methods 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 set PrintComments and set PrintErrors methods, Aspose.Cells also provides two enumerations, PrintCommentsType & PrintErrorsType that contain pre-defined values to be passed a parmeters to set PrintComments and set PrintErrors methods respectively.
//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 set Order method that is used to order multiple pages of your worksheet to be printed. There are two possibilities to order the pages as follows:
Down then over thus it will print all pages down before printing pages to the right Over then down thus it will print pages left to right before printing pages below Aspose.Cells provides an enumeration, PrintOrderType that contains all pre-defined order types to be assigned to setPage Order method.
//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.