Apose cells Excel to PDF not working properly when we have multiple columns in .NET

Hi I am exporting Excel to PDF using .NET API…The excel is formed by Aspose cells worksheet. There are 20 column and has 100 rows of data . Each page displaying 10 rows of data. So After I rendered as PDF
I can see It can accommodate only 10 columns in the page since we had to assign width from cells.
Issue is I can see first 10 columns data for all 100 rows and then I can able to see next 10 columns from 11th page. Incase if the cells are not accomondated to single page, I need to display those Columns in Subsequent page … Not after 11 pages. How Can I do that? Is there any workaround for this?

@ramanlakshmanan,

Thanks for your query.

Well, Aspose.Cells follows MS Excel standards and specifications and cannot go beyond it. Aspose.Cells renders the Excel spreadsheet to PDF file format based on what is shown in the print previews of different worksheets (in the workbook). MS Excel built-in render also does the same as you may confirm this by re-saving your file as PDF file format in MS Excel manually. As you are extending the width of the columns, so you might be seeing 10 columns per page.
I think you may make use of other Page Setup attributes/options in MS Excel before rendering to PDF, please open the Page Setup dialog box for any worksheet for reference. You can specify each PageSetup or other printable options via Aspose.Cells APIs accordingly too.

If you still could not evaluate it, kindly do provide us your template Excel file and your desired file (you may make use Page Setup options to render your desired data set shown in each page as per the Print Preview of MS Excel), we will check and let you know on how to do it via Aspose.Cells APIs.

I Understand the difficulties to display all columns in single page. But Is there possibility to display the all columns in pdf in sequence order. As of now I can see Column 1 to column 8 values in first pages. Each page displays 50 records.

Instead of that I want to display first 50 records of Column 1 to Column 8 in first page and then I need to display the corresponding 50 records of Column 9 to Column 16 in page 2 and then matching 50 records of column 17 to column 21 in page 3 .

I want to display the records in this way. Is there a way to do this?

Parameterpage - Copy.pdf (56.0 KB)

@ramanlakshmanan,

Thanks for the PDF file.

As requested earlier, kindly do provide us template Excel file with data splitted with your desired sequence when viewing the sheet in Print Preview in MS Excel (you may make use of Page Setup options to try to render your data in accordance with your requirements), If this possible in MS Excel, then we will let you know on how to do it via Aspose.Cells APIs.

I have uploaded the excel file in this attachment. Please verify it and let me know…

Parameterpage.zip (13.8 KB)

@ramanlakshmanan,

Thanks for the file.

Well, I asked your to provide the Excel file with your data splitted according to your desired sequence when worksheet is shown in Print Preview in MS Excel (see my previous reply for your reference).

For your information, by default, MS Excel does render data vertically using top to down approach, it means if a set of column (with certain rows) are pasted in the first pages, on the second page, the next set of the same columns would be pasted until the last row for those columns. Please view your sheet in Page Break Preview in Ms Excel to know what I am saying.

By the way, if you like, you may render more columns or even all the columns in a single page if it suit your needs, see the document for your reference:

Anyways, I will explore using Ms Excel manually further and let you know shortly.

Thank you.

@ramanlakshmanan,

After further evaluation in MS Excel, I come to know that you may set the order for data of the sheet before rendering to PDF file format to accomplish your task, see the sample lines of code for your reference:
e.g
Sample code:


PageSetup pageSetup = workbook.Worksheets[0].PageSetup;
pageSetup.Order = PrintOrderType.OverThenDown;

Let us know if I can be of any further help.