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

Free Support Forum - aspose.com

"Shape to image Error!" on azurewebsites.net- running fine locally 8.2.2

Running the evaluation version of Aspose.Cells 8.2.2.0.

Converting xlsx to PDF using the .NET 3.5 assembly.
Locally running VS2012 / IISExpress --> all fine
Publish to an Azure website --> "Shape to Image Error!"
Any clues?
Thanks!
Peter

My code roughly looks like:

using (var input = new MemoryStream())
{
using (var output = new MemoryStream())
{
template.TemplateFile.SaveToStream(input); // xlsx file
input.Position = 0;
var wb = new Workbook(input);
wb.Save(output, SaveFormat.Pdf);
StreamToResponse(output, fileName);
}
}


Hi Peter,


Thank you for considering Aspose APIs, and welcome to Aspose.Cells support forum.

I am afraid, we cannot say what could have triggered the said exception unless we review your sample spreadsheet and source code. We would request you to please provide us the an executable standalone application, sample spreadsheet (if any) and complete stack trace for further investigation. We will review the case on our end by deploying it (if required). Please also state if you are seeing the exception in all cases or in a random fashion.

Please note, more information regarding your scenario/environment will ease the task of investigation and we can move forward towards the correction (if applicable).

Dear Support

Please find attached the xlsx file.
My code is very simple, it’s a handler with the below code. Streaming the xlsx file is fine, as soon as wb.Save in PDF, I get a ‘Shape to image Error!’ message. Please note it runs fine locally (on iisexpress). It also runs fine, both locally and on Azure, if I do a wb.Save(stream, SaveFormat.xlsx).
Thanks!
Peter


public class VitReports : IHttpHandler
{

public void ProcessRequest(HttpContext context)
{
try
{
// 1. BELOW is OK
//var stream = new FileStream(context.Server.MapPath("~/TEMPLATE_SAV045.xlsx"), FileMode.Open);
//MaintenanceVisitController.StreamToResponse(stream, “TEMPLATE_SAV045.xlsx”, context);

// 2. BELOW IS NOT OK
var wb = new Workbook(context.Server.MapPath("~/TEMPLATE_SAV045.xlsx"));
var stream = new MemoryStream();
wb.Save(stream, SaveFormat.Pdf); // SaveFormat.xlsx IS FINE
stream.Position = 0;
MaintenanceVisitController.StreamToResponse(stream, “TEMPLATE_SAV045.pdf”, context);
}
catch (Exception e)
{
SetErrorResponse(context, e);
return;
}
}

Just read it’s apparently a know issue, already logged as CELLSNET-43119.

Hi Peter,


Thank you for providing the sample spreadsheet for our review, however, we were looking for more information from your end. Please note, we are unable to replicate the said problem on localhost while using the code snippet from your recent message therefore we require the complete stack trace of the exception for thorough investigation. Moreover, we demanded the sample application (along with its dependencies) to assess the type of web application and the set of assemblies that could have caused the problem. Could you please re-consider our request and provide the missing information?

Regarding the CELLSNET-43119, the error message is the same however the issue was easily reproduced in a simple console application (targeted .NET 2.0) by loading the spreadsheet in an instance of Workbook, and saving it back on disc in PDF format without first saving the results in stream. Unless we thoroughly analyze your presented scenario (and we need more information for it), we cannot establish that both errors are caused due to the same conditions. Anyway, CELLSNET-43119 is currently in analysis phase, and as soon as the aforesaid ticket is resolved, we will provide the fix here as well so you may give it a try at your end.