Free Support Forum - aspose.com

Wrong page numbering when saving workbook as pdf


#1

Hello,

Using the 19.4 last version of Aspose.Cells, I have created a small .net program that open a Workbook and save it as pdf.

var strFileName = “test.pdf”;
var AWB = new Aspose.Cells.Workbook(strFileName.Remove(strFileName.Length - 4) + “.xlsx”);
AWB.Save(strFileName, Aspose.Cells.SaveFormat.Pdf);

In the workbook I have 2 sheets. I have setup the pages in Excel :

  • first page number: 0
  • custom footer: &[Page]​​
  • different first page: checked​

​When i save as pdf I have the folowing result, different from what i get in the Excel print preview for the entire workbook:

  • “Page 0” is visible but I was expecting not visible
  • “Page 1” is not visible, I was expecting visible (then pages 2,3,4 are visible again)
  • the page count does not restart to 0 for each worksheet and I was expecting it to restart

Please find attached the test workbook.
test.zip (9.9 KB)

Do you have any idea of how to fix that or a workaround ?

I was thinking of exporting each sheet separately as pdf then merge them, but it is quite heavy… and the 1st page is still visible while the 2nd one is not.

Than you in advance.


#2

@odellenbach,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46727 - Wrong page numbering while saving workbook as PDF

For your reference, my output file attached here:
test.pdf (23.6 KB)


#3

@odellenbach,

Please try our latest version/fix: Aspose.Cells for .NET v19.4.6 (attached)

Your issue (logged earlier as “CELLSNET-46727”) should be fixed in it.

Let us know your feedback.
Aspose.Cells19.4.6 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.4.6 For .Net4.0.Zip (4.9 MB)


#4

Hello,

I tested succesfully your fix thank you.

For the issue “page count does not restart to 0 for each worksheet and I was expecting it to restart”,
it is acutally when FirstPageNumber is set to 1 (and only 1, as it is working fine with 0 et 2,3,4…)

if you take this excel
test.zip (50.4 KB)
you will see that in excel print preview, the page number restart to 1 on next sheet
and not in the aspose pdf output.

Let me know if you can fix that also or if I need to create a new ticket.

Thank you!


#5

@odellenbach,

Good to know that your original (previous) issue was fixed with the new fix.

After an initial test, I am able to reproduce the issue as you mentioned by converting your template file to PDF file format. I found that page number does not restart to 1 on each sheet in the output PDF. I have logged a ticket with an id “CELLSNET-46735” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.


#6

The issues you have found earlier (filed as CELLSNET-46727) have been fixed in Aspose.Cells for .NET v19.5. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi