// Create a pdf file stream using FileStream outputStream = new FileStream("GetPaginationInfo.pdf", FileMode.Create); //create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); var fileStream = this.GetResourceStream("xlsx\\Medical office start-up expenses 1.xlsx"); workbook.Open(fileStream); IWorksheet worksheet = workbook.Worksheets[1]; GrapeCity.Documents.Excel.PrintManager printManager = new GrapeCity.Documents.Excel.PrintManager(); // The columnIndexs is [4, 12, 20], this means that the horizontal direction is split after the column 5th, 13th, and 21th. IList<int> columnIndexs = printManager.GetPaginationInfo(worksheet, PaginationOrientation.Horizontal); // The rowIndexs is [42, 61], this means that the vertical direction is split after the row 43th and 62th. IList<int> rowIndexs = printManager.GetPaginationInfo(worksheet, PaginationOrientation.Vertical); // Save the pages into pdf file. IList<PageInfo> pages = printManager.Paginate(worksheet); printManager.SavePDF(outputStream, pages); // close the pdf stream outputStream.Close();
' Create a pdf file stream Dim outputStream = File.Create("GetPaginationInfo.pdf") ' Create a new Workbook Dim workbook As New Workbook 'Open an excel file Dim fileStream = GetResourceStream("xlsx\\Medical office start-up expenses 1.xlsx") workbook.Open(fileStream) Dim worksheet As IWorksheet = workbook.Worksheets(1) Dim printManager As New Excel.PrintManager 'The columnIndexs is [4, 12, 20], this means that the horizontal direction is split after the column 5th, 13th, and 21th. Dim columnIndexs As IList(Of Integer) = printManager.GetPaginationInfo(worksheet, PaginationOrientation.Horizontal) 'The rowIndexs is [42, 61], this means that the vertical direction is split after the row 43th and 62th. Dim rowIndexs As IList(Of Integer) = printManager.GetPaginationInfo(worksheet, PaginationOrientation.Vertical) 'Save the modified pages into pdf file. Dim pages As IList(Of PageInfo) = printManager.Paginate(worksheet) printManager.SavePDF(outputStream, pages) ' close the pdf stream outputStream.Close()