We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problems with FirstPageNumber property

Hello,
I’m using Aspose.Cells v7.0.3.0 to generate a report consisting of multiple sub-reports, where each sub-report is on a separate sheet of the workbook. See attached file PageNumbers.auto.xls for an example. I would like the page numbers to start after the first sheet, which is a table of contents. So I’m setting the FirstPageNumber property for each sheet after the first one. If I do this directly in Excel, I get the results I want. When I do it through Aspose, the results are not right.

The XLS result shows the correct page numbers for the third and fourth sheet, but the second sheet shows Auto. The XLSX shows Auto for all sheets, and the PDF reflects this. Interestingly, when I load the XLSX back into Aspose, the settings seem to be correct.

Following is the code I’m using to set the property. Is there anything additional I need to do to make the page numbers come out the way I want?

public void TestFirstPageNumber()
{
var filename = string.Format(@"{0}PageNumbers\PageNumbers.", TestHelper.InputDirectory);
var original = new Workbook(filename + “auto.xls”);

Assert.That(original.Worksheets.Count, Is.EqualTo(4));

///Assert.That(original.Worksheets[1].PageSetup.FirstPageNumber, Is.Not.EqualTo(1)); //fails - is there no difference between 1 and Auto?
Assert.That(original.Worksheets[2].PageSetup.FirstPageNumber, Is.Not.EqualTo(2));
Assert.That(original.Worksheets[3].PageSetup.FirstPageNumber, Is.Not.EqualTo(4));

original.Worksheets[1].PageSetup.FirstPageNumber = 1;
original.Worksheets[2].PageSetup.FirstPageNumber = 2;
original.Worksheets[3].PageSetup.FirstPageNumber = 4;

original.Save(filename + “new.xls”);
original.Save(filename + “new.xlsx”);
original.Save(filename + “new.pdf”);

var copy = new Workbook(filename + “new.xlsx”);
Assert.That(copy.Worksheets[1].PageSetup.FirstPageNumber, Is.EqualTo(1));
Assert.That(copy.Worksheets[2].PageSetup.FirstPageNumber, Is.EqualTo(2));
Assert.That(copy.Worksheets[3].PageSetup.FirstPageNumber, Is.EqualTo(4));
}

Hi,


I can find the issue as you have mentioned by running your sample code with your template file. I got issues especially for the output XLSX and PDF files. I have logged a ticket with an id: CELLSNET-40345. We will look into it soon.

Thank you.

Hi,

Please download and try this fix: Aspose.Cells for .NET v7.1.0.6

I tried the 7.1.0.6 update, but I am seeing exactly the same results for the same code. The first sheet/page after the table of contents (“First Report”) shows a page number of 2, even though my code has told this sheet to use 1 as its first page number. In the XLSX and PDF versions, all subsequent sheets also show wrong page numbers.

Is there anything I need to do differently in my code to make the page numbers show what I want?

Mishelle

Hi,

Thanks for your feedback.

I have reopened this issue and added your feedback inside it. We will look into it and fix the problems asap.

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET

v7.1.1.6

The issues you have found earlier (filed as CELLSNET-40345) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.