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

Free Support Forum - aspose.com

Export tp pdf format not correct

Hello Support

I have attached a xls file which I am trying to Export to PDF with Aspose cells. The problem is that
document is exported to pdf but not in a sheet form instead export splits excel sheet into many pages. Can you suggest solution for this problem. My requirement is to see the pdf document similar to as it look in excel document in a single sheet or table form. I am using following code

Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(“Aspose.Total.lic.xml”);
Workbook workbook = new Workbook(excelFilename);

workbook.Save(fileName, SaveFormat.Pdf);

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please use the following code for your needs. The code will create a single page for your entire worksheet.

I have also attached the output pdf for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\docu.xlsx”;


Workbook workbook = new Workbook(filePath);


PdfSaveOptions opts = new PdfSaveOptions();

opts.OnePagePerSheet = true;


workbook.Save(filePath + “.out.pdf”, opts);


Hi

Thanks for the solution. It is working. Now I have another problem that I am not able to export the excel file “docu2.xlsx” I attached with email to PDF. I get a runtime error “Object reference not set to an instance of an object.” at Workbook workbook = new Workbook(filePath);
while exporting this document. What can be a solution for this problem.

Regards
Dani

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to generate this exception using the following code. We have logged this issue in our database.

We will look into this issue and fix it. Once, we will have some fix or update for you, we will let you know asap.

This issue has been logged as CELLSNET-41382.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\docu2.xlsx”;


Workbook workbook = new Workbook(filePath);

Hi,


Please try the new fix/version: Aspose.Cells for .NET (Latest Version) .

We have fixed your issue now


Thank you.

Hi Amjad

Thanks for fixing the problem. Can you please send me the link for the complete installer/setup with this fix (perhaps aspose Total setup link as we have already purchased the license for Aspose total).

Regards
Dani

Hi Amjad

I have tried the new dll’s you sent me. The previous problem is solved but there is another issue that cells text in Rows “Multiple Lines” and “Multiple Lines2” appear to be truncated and docu2.xlsx and docu2.pdf appear different. How can I export complete view from docu2.xlsx to docu2.pdf. I have attached both excel file and pdf I generated from this. Thanks.

Regards


Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to notice this issue using the following code. We have attached the output pdf and screenshot for a reference.

We will look into your issue and fix it. Once the issue is fixed or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSNET-41390.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\docu2.xlsx”;


Workbook workbook = new Workbook(filePath);


PdfSaveOptions opts = new PdfSaveOptions();

opts.OnePagePerSheet = true;


workbook.Save(filePath + “.out.pdf”, opts);

Screenshot:

Hi,

We have looked into your issue. Please use the following code to get rid of the multiple text rows issue.

C#


AutoFitterOptions afo = new AutoFitterOptions();

afo.IgnoreHidden = true;

afo.OnlyAuto = true;

foreach (Worksheet ws in workbook.Worksheets)

{

ws.AutoFitRows(afo);

};

Hi Shakeel

Thanks. Works now.

Regards
Daniyal

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.