[]
GcExcel .NET enables users to export multiple worksheets to a single page in the PDF file.
This feature is useful especially when you want to analyse all the crucial data at one place in order to facilitate the sharing, manipulation and printing of data in an efficient way. For instance - let's say you have a workbook with multiple worksheets wherein you want to export the content of some worksheets (containing similar type of data) so that all the related data appears on the same page and is saved into a specific page in the PDF file. In this scenario, you can use this feature to export and print data from more than one worksheet to a single page in the PDF file as per your custom requirements and preferences.
In order to export multiple worksheets into a single page of the PDF file, users need to create an instance of the PrintManager class, get the default pagination settings of the workbook using the Paginate() method, use the Draw() method of the PrintManager class and finally save the PDF file using the GcPdfDocument.Save() method.
Note: In order to export multiple sheets to one page, you should have a valid license for GrapeCity Documents for PDF.
Refer to the following example code to allow users to export multiple worksheets to a single page in the PDF file.
// Initialize workbook
Workbook workbook = new Workbook();
// Open Excel file
workbook.Open("MultipleSheetsOnePage.xlsx");
/* NOTE: To use this feature, you should have a valid license
for GrapeCity Documents for PDF.*/
// Create a PDF document
GcPdfDocument doc = new GcPdfDocument();
// This page will save data for multiple pages
Page page = doc.NewPage();
// Create an instance of the PrintManager class
PrintManager printManager = new PrintManager();
// Get the pagination information of the workbook
IList pages = printManager.Paginate(workbook);
/* Divide the multiple pages into one row and
two columns and print them on one page */
printManager.Draw(page, pages, 1, 2);
// Save the document to PDF file
doc.Save(@"PrintMultiplePagesToOnePage.pdf");