[]
DsExcel allows you to arrange pages from multiple worksheets on a single page in a PDF document. This is useful when related data is stored in different worksheets and needs to be presented together.
To export the worksheet pages, create a PrintManager instance and call the Paginate() method to generate the pagination information for the workbook. Then, create a page in a GcPdfDocument and use the Draw() method to arrange the paginated pages in the required number of rows and columns. Finally, call the GcPdfDocument.Save() method to save the PDF document.
The pagination result is based on the print area and page setup of each worksheet. Therefore, a worksheet may generate one or more pages. In the following example, the paginated pages are arranged in one row and two columns on a single PDF page.
Note: In order to export multiple sheets to one page, you should have a valid license for Document Solutions 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 Document Solutions 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<PageInfo> 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");