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

Free Support Forum - aspose.com

Exception when saving excel as pdf

Using tha actual version of Aspose.Cells and reading the attached excel sheet to save as PDF runs into an system null reference exception.

Here is a short code example:

string urlBase = “Forecast.xlsx”;
Aspose.Cells.License lic = new Aspose.Cells.License();
lic.SetLicense(“Aspose.Total.lic”);
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(urlBase);
wb.Save(urlBase.Replace(".xlsx", “.pdf”), Aspose.Cells.SaveFormat.Pdf);

Excel sheet is without any specials …

DO you have any idea?

Greetings
Christian

Hi,


It works absolutely fine. I used latest version/fix: Aspose.Cells for .NET (Latest Version) . Please try it. Here is my sample code that works fine.

Sample code:

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(e:\test2\Forecast.xlsx);
wb.Save(“e:\test2\outForecast.pdf”, Aspose.Cells.SaveFormat.Pdf);


I’ve used the version from 24.11.2011, but I still have the same problem.

I attached an excel file with more content. But I have the problem with the last one too.

Exception details:
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. (= object reference not set to …)
bei Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)

Can you try again?

Greetings
Christian

Hi,


Please make sure that you are using the latest fix v7.0.3.2 in your project. I used it with your newly attached Excel file and it again works fine.

Following is my sample code:

Sample code:
string urlBase = “e:\test2\Forecast.xlsx”;
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(urlBase);
wb.Save(urlBase.Replace(".xlsx", “.pdf”), Aspose.Cells.SaveFormat.Pdf);

Please also find attached the output PDF file running the above code.

If you still find the issue, please create a separate sample application using v7.0.3.2, zip it and post it here to reproduce the issue on our end, we will check it soon.

Thank you.

Hi,

I think problem is the fonts used in the excel sheet. I attached fonts for you.

If I change fonts e.g. to Tahoma, everything is rendered fine. But if I use Conduit, I get the exception.

Can you test at your system?

Another possible issue: I’m using german operating system windows 7, I think, you have got english version, because all formatting is English style in attached pdf.

Greetings
Christian

Hi,

We do not support otf font, please convert it to TTF font, we do this and convert the Excel file successfully.

Thank you.