Blank pages rendered while converting Excel to PDF using Aspose.Cells for .NET in C#

Hi,

When I convert my excel file to pdf,pdf version have blank pages.I attached original file.Could you please check it?

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were not able to reproduce this issue. Please download and use the latest version:
Aspose.Cells for .NET (Latest Version)
It should fix your problem.

Please see the output pdf generated using the latest version for your reference.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET (Latest Version)

I have tested and converted your template file (you attached) to PDF, it gives 4 pages (which are not blank) similar to MS Excel’s print preview.

Thank you.

Hi I tried with 7.3.0.1.But problem is the same

I am using following method.Maybe it can help you

foreach (Worksheet sheet in workbook.Worksheets)

{

maxCol = sheet.Cells.MaxColumn;

maxRow = sheet.Cells.MaxRow;

if (maxCol > 0 && maxRow > 0)

{

Aspose.Cells.

PageSetup pageSetup = sheet.PageSetup;

pageSetup.PrintArea =

"A1:" + CellsHelper.CellIndexToName(maxRow, maxCol);

}

}

v

Hi,


I think since you are using MaxRow and MaxColumn attribute which would give you the farthest row/column indexes having any kind of formatting or data, so you are getting blank pages. The best way is, don’t specify your printable area at all as it is already set to A1:G118 in your template file. If you still persist on setting the print area, then please use MaxDataRow and MaxDataColumn properties.

foreach (Worksheet sheet in workbook.Worksheets)

{

maxCol = sheet.Cells.MaxDataColumn;

maxRow = sheet.Cells.MaxDataRow;

if (maxCol > 0 && maxRow > 0)

{

Aspose.Cells.

PageSetup pageSetup = sheet.PageSetup;

pageSetup.PrintArea =

“A1:” + CellsHelper.CellIndexToName(maxRow, maxCol);

}

}

when I used

maxCol = sheet.Cells.MaxDataColumn;

maxRow = sheet.Cells.MaxDataRow; properties ,

I had another problems and your team suggested me that using MaxColumn and Maxrow properties

Hi,


Well, as I said earlier, you should not use MaxRow and MaxColumn here, because, there are lots of blank cells having some sort of formattings (e.g row heights are set and column widths are set), so when you use MaxRow and MaxColumn, it may include the cells upto last cell of the sheet in the last (256th) column --> IV.

I think you should simply remove or make it null any printable area set in the sheet’s page setup of your template file either by manually or using the APIs.

Thank you.