Problem converting MS-Excel file to PDF using Aspose.Cells

Hi,

I have generated .xl file using aspose.cells, now i am trying to convert to PDF.

I have converted the xl file in this way.

Workbook workbook = new Workbook();

Worksheet worksheet = workbook.Worksheets[0];

workbook.Save(Path.ChangeExtension(path, “.Pdf”), FileFormatType.AsposePdf);

But while opening the file getting error message like “Could not open the file because its either a not supported file type or because file has been damaged.”

Please send your response as soon as possible.

With Regards,
Prithiviraj.M


Hi Prithiviraj,


Thank you for contacting Aspose support.

It seems that you are using an older version of the Aspose.Cells for .NET API because the overload version of the Workbook.Save method accepting the FileFormatType as second parameter has been obsoleted.

Please change the code as follow, and it should resolve the mentioned issue.

C#

workbook.Save(“D:/temp/out.pdf”, SaveFormat.Pdf);