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

Free Support Forum - aspose.com

I want to generate Excel file and convert Excel file to PDF by using Aspose Cells

Hi Team,

We are planning to use Aspose.Cells in ASP.NET Core 3.1 Web API application to generate Excel file and deployed in AWS environment. We have to apply color formatting in Excel file (.xlsx format) and PDF file as well.

Front End: angular 8

Back End: ASP.NET Core 3.1 Web API

Environment: AWS (Lambda)

Could you please confirm that which version we have to use to work in above environment and also cost details to procure new licence?

@SenthilRG27,
Aspose.Cells for .NET API supports ASP.NET Core and there should not be any issue. For example, it was also acknowledged by a user in this thread.
Aspose.Cells in AWS Lambda .NET Core 2.1 Function: Exception when saving to PDF

You can download latest version of API and if you face any issue then let us know your feedback. For pricing and cost information, you can post at Purchase Forum for more information.

I have used below code to generate Excel file. Below code is working fine in local environment. After deploying code in AWS environment (Lambda), I am getting file corrupted issue.

[HttpGet]
public IActionResult Get()
{
Workbook workbook = new Workbook();
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Put some value in cell C4
Cell cell = worksheet.Cells[“C4”];
cell.PutValue(“This is XLSX format generated by Aspose.Cells API.”);
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.Xlsx);
Response.Clear();
Response.ContentType = “application/vnd.ms-excel”;
Response.Headers.Add(“Content-Disposition”, “attachment; filename=myfile.xlsx”);
Response.Body.Write(ms.ToArray());
return Ok();
}

Aspose Cell DLL version is “20.4.0”. Also we have to convert Excel file to PDF file as well.

@SenthilRG27,
We have tried to reproduce the issue here but could not succeed. Please share the details about file corruption which is observed in the production environment. We will log a ticket to investigate it further once we get more details about the exception/issue.

https://purchase.aspose.com/temporary-license

@ahsaniqbalsidiqui,
I have attached corrupted file for your reference. I am able to download .CSV file after deploying in AWS environment by using below code. If I use above code to generate .Xlsx file, I am not able to open the downloaded file(corrupted).

[HttpGet]
public IActionResult Get()
{
Workbook workbook = new Workbook();
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Put some value in cell C4
Cell cell = worksheet.Cells[“C4”];
cell.PutValue(“This is XLSX format generated by Aspose.Cells API.”);
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.CSV);
Response.Clear();
Response.ContentType = “application/vnd.ms-excel”;
Response.Headers.Add(“Content-Disposition”, “attachment; filename=myfile.csv”);
Response.Body.Write(ms.ToArray());
return Ok();
}

CorruptedFile.zip (5.4 KB)

@SenthilRG27,
Could you please try to set “SaveFormat.Xlsx” instead of “SaveFormat.CSV” and let us know your feedback.

I have tried SaveFormat.Xlsx as well. No luck.

[HttpGet]
public IActionResult Get()
{
Workbook workbook = new Workbook();
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Put some value in cell C4
Cell cell = worksheet.Cells[“C4”];
cell.PutValue(“This is XLSX format generated by Aspose.Cells API.”);
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFormat.Xlsx);
Response.Clear();
Response.ContentType = “application/vnd.ms-excel”;
Response.Headers.Add(“Content-Disposition”, “attachment; filename=myfile.xlsx”);
Response.Body.Write(ms.ToArray());
return Ok();
}

@SenthilRG27,
We were not able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as
CELLSNETCORE-63 – Issue while generating excel file in AWS environment

@ahsaniqbalsidiqui
Please update me once you have resolved the issue. Thank you for your support.

@SenthilRG27,
Sure, we will update once any feedback is ready to share.

@SenthilRG27,
Would you please share a whole project?
It could be simple, but runnable. It would be helpful for us to investigate this issue.

@ahsaniqbalsidiqui
I have attached whole project for your reference.
Aspose.Cells.Sample.zip (775.4 KB)

@SenthilRG27,
Thank you for sharing the sample project. We will analyze it and share our feedback after testing the issue using this project.

@ahsaniqbalsidiqui
Have you found out the solution by using attached sample project?

@SenthilRG27,
Thank you for providing the sample project however I am afraid that this issue is still not resolved. We will write back here as soon as some feedback is ready to share.

@ahsaniqbalsidiqui, @Amjad_Sahi
If above mentioned issue has been resolved in your end, we are planning to buy license for Aspose Cells. Please resolve the issue.

@SenthilRG27,
Due to complexity of the issue it is still not resolved. We are gathering information to provide you some ETA (if possible) and will write back here soon to share the updated status.

@SenthilRG27,

We have tested this issue with a “AWS Serverless” project. We use local machine (IIS) and deploy to AWS Elastic Beanstalk, it works fine, we get the correct XLSX file (8KB). But when deployed to AWS Lambda, we reproduced this issue, got the crashed file (13KB).

As the file can be created well when deploying to AWS Elastic Beanstalk, we think it maybe caused by some usage rules on AWS Lambda. We will look into it further. It is hard to estimate an ETA, but we will try to treat it with high priority.

Once we have an update on it, we will let you know.

@SenthilRG27,

We have investigated this issue further. We can get a correct XLS file on AWS Lambda platform (XLSX can be retrieved by similar way) now. We found some difficulties while implementing and these were really caused by some usage rules on AWS Lambda. Anyways, it works. Please note, it is hard to explain in one simple statement. We have prepared a sample (attached) for you for your reference. Please check the attachment, we have also written some details on the usage and findings while working on the test project. Hopefully the sample with “readme.txt” will be helpful to you for your scenario.
CELLSNETCORE63.zip (163.7 KB)

@Amjad_Sahi, @ahsaniqbalsidiqui,

Thank you for your support.