Contents at the bottom are cut into half and moved to next page. Also there is a empty space at the bottom of the page and the contents are moved to next page

I’m using aspose-cells version 24.6. I’ve tried clearing the vertical page breaks still facing the issue. The contents are cut off at the bottom as half and moved to next page so it makes it unreadable. Some times there is a blank space at the bottom of the page
I have uploaded the screen shot of the pdf how it looks
image.png (41.2 KB)

@Prasanth_G
Would you like to provide your sample file and executable Console project? We will check it soon.

Contents.pdf (423.6 KB)

In this file at page number 10 at the bottom you can see the space as well as the text are cutoff into half and moved to next page. In page number 8 also it is happening the same way

@Prasanth_G
Would you like to provide your Excel sample file? You can compress the Excel file into zip format and upload it here. If you could provide test code, it would be very helpful for us to locate the issue. We will check it soon.

excelFileToConvertintoPDF.zip (14.5 KB)

Here is the excel file.

@Prasanth_G,

Thanks for the template Excel file.

I checked the contents/data in the worksheet cells of your Excel file. There is a large amount of data in some merged cells of column B. Therefore, even if you set the “Fit All Columns on One Page” option, some merged cells on pages 7 and 10 may not display the full data. To confirm, please open your file in MS Excel manually, go to Page Setup, and then select Print Preview. Now choose the “Fit All Columns on One Page” option. After that, check different pages in the preview and you will notice that Pages 7, 9, and 10 have some data (in cells like B144 and B163, etc.) that is either cut off or not fully displayed.

In short, this is not an issue with Aspose.Cells in any way. Aspose.Cells follows MS Excel standards and specifications when rendering to the PDF file format. What you see in the print preview of the sheet (after setting Page Setup options) is what is rendered in the output PDF by Aspose.Cells. Even if you try to render to PDF via MS Excel, you will notice similar results. To display maximum data in those merged cells, you need to extend the width of column B so that certain cells can display the data. Alternatively, you may split the large data into multiple cells, save the file again, and then render it to PDF.

The best way to address this issue is to open your Excel file, adjust the data and format column widths, and then set some “Page Setup” options until you achieve your desired results in the print preview. After that, use Aspose.Cells to apply all your formatting and Page Setup options in the code, and then render to PDF via Aspose.Cells.

@amjad.sahi
The issue is not about the truncation of data in the uploaded image you can see a gap and text are cut off at the bottom as half in one page another half in the next page. You can see the pdf for reference which I have already shared
text_Cut.png (22.1 KB)

image.png (41.2 KB)

@Prasanth_G,

I tested using the following sample code with your template XLSX file using Aspose.Cells for .NET v24.6 and generated the output PDF file.
e.g.,
Sample code:

Workbook workbook = new Workbook("e:\\test2\\excelFileToConvertintoPDF.xlsx");
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.AllColumnsInOnePagePerSheet = true;            
workbook.Save("e:\\test2\\output_Aspose_Cells.pdf", saveOptions);

Please find attached the output PDF file by Aspose.Cells for .NET v24.6 (please try it if you are not already using it).
output_Aspose_Cells.pdf (282.5 KB)

I then opened your Excel file into MS Excel 2019. I then set “Fit All Columns on One Page” of PageSetup and saved to “PDF” manually. Please find attached the output PDF by MS Excel.
output_Excel.pdf (406.1 KB)

Now I compared pages (7,9,10 etc) of both files and found Aspose.Cells works almost the same way as MS Excel does to render PDF.

Please separate the issue for Aspose.Cells and do not involve Aspose.PDF. Please only generate a PDF file using Aspose.Cells after specifying the settings. If you still encounter any issues using Aspose.Cells for .NET v24.6, kindly provide your sample code, output PDF, and screenshots (comparisons) for reference. We will check your issue soon.

@amjad.sahi
I’m using PageSetup class to set the paper size so If I set the allColumnsInOnePagePerSheet as true the width of the pageSetup will not be considered. And I have used autoFitMergedcells and autofitrows method I’m getting all contents in my pdf but it is getting cut into half which makes it unreadable. In the attached pdf you can see in page number 10.
Contents.pdf (423.6 KB)

@Prasanth_G
Based on the information you provided, we can reproduce the issue by testing it on the latest version v24.6 using the sample file and the following sample code. Discovered that Contents at the bottom are cut into half and moved to the next page when saving file to PDF. Please refer to the attachment. result.zip (570.7 KB)

The sample code as follows:

Workbook workbook = new Workbook(filePath + "excelFileToConvertintoPDF.xlsx");
Worksheet sheet = workbook.Worksheets[0];
sheet.PageSetup.PaperSize = PaperSizeType.PaperA4;
sheet.PageSetup.LeftMargin = 0;
sheet.PageSetup.RightMargin = 0;
sheet.PageSetup.CenterHorizontally = true;

AutoFitterOptions options = new AutoFitterOptions();
options.AutoFitMergedCellsType = AutoFitMergedCellsType.EachLine;
sheet.AutoFitRows(options);
workbook.Save(filePath + "output_Aspose_Cells.pdf");

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-56081

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Prasanth_G ,

If a merged cell contains more than one rows, and the page break is located in the merged cell, the text line in the merged cell may be cut into two pages.

If you use the following code, please save it to xlsx file before saving to pdf. Then open the saved xlsx file in Excel, you will find that the text in page 10 is also cut in Excel Printview:
Screenshot_page10.png (166.6 KB)

What is the update on issue ID : CELLSNET-56081

@Ayush.sinha.esko,

We found that the issue is not with the Aspose.Cells APIs, as MS Excel also displays the same behavior. Therefore, we will not fix it and consider the matter closed. For reference, please see our previous reply in the thread.