Free Support Forum - aspose.com

Cells convert to PDF error

I have a workbook with 2 worksheets, the first one contains data which is then summarised in the second worksheet in the form of 2 graphs and 1 table. I'm having a problem with the table not displaying correctly when converting to PDF, all the values in the table are 0 when in the Data worksheet there are values for each of the cells.

This works fine when creating the workbook in Excel format, so i'm wondering whether it has something to do with the cells not being updated as they are referencing cells in another Worksheet. In Excel I think it recalculates the values on opening the file, but when converting it to PDF it doesn't have a chance to do this which could be why this is happening.

If you have any suggestions please could you let me know?

Thanks

Hi,

Thanks for considering Aspose.

I think you may try to add the following line of code before saving the .xml (Aspose.Pdf Integrated) file for the conversion:

workbook.CalculateFormula();

If you still find the problem, post your sample code, .xls file and .pdf file, We will check it soon.

Thank you.

Hi,

That worked great thanks for the quick response. However I've noticed another issue with the Workbook to do with setting the print area for a worksheet. When creating the sheet in PDF the print area is set correctly, however when saving the sheet in Excel format the PrintArea never seems to change. Below is a summary of the code I'm using, can you see anything wrong with it?

Aspose.Cells.Workbook templateWorkbook = new Workbook();

templateWorkbook.Open(templateFileName);

Worksheet currentYearReportSheet = templateWorkbook.Worksheets["Report"];

//methods to add data to the worksheet go here

currentYearReportSheet.PageSetup.PrintArea = "A1:L50";

templateWorkbook.Save(filename, FileFormatType.Excel2003);