Exporting Excel sheet to image throws Out Of Memory Exception

Hi,

I am working for Microsoft and we hold a valid Aspose.Total .NET platform license. I am working on a tool that is supposed to convert first sheet of each excel file into a .bmp image. I am using the below code snippet to achieve this.

//initializing Aspose license for Excel Application
AsposeExcel.License license = new AsposeExcel.License();
license.SetLicense("Aspose.Total.lic");

//initializing Aspose Excel Workbook object with the provided excel template.
AsposeExcel.Workbook workBook = new AsposeExcel.Workbook(sourcePath);

//fetch file name of excel template without extension i.e. asset id
fileName = Path.GetFileNameWithoutExtension(workBook.FileName);

//define the temporary image format.
imageFileExtension = ".bmp";

//initializing image saving options and defining the image format.
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Bmp;
options.OnePagePerSheet = false;

//initializing sheet render object with first sheet in the workbook
Aspose.Cells.Rendering.SheetRender renderImage = new Aspose.Cells.Rendering.SheetRender(workBook.Worksheets[0], options);

//looping through all the pages in the first sheet.
for (int i = 0; i < renderImage.PageCount; i++)
{
renderImage.PageCount = 1;

//creating the temporary bmp file in the temp folder
renderImage.ToImage(i, tempFolderPath + @"\" + fileName + "_Bmp" + ++imgCounter + imageFileExtension);
}//initializing Aspose license for Excel Application
AsposeExcel.License license = new AsposeExcel.License();
license.SetLicense("Aspose.Total.lic");

//initializing Aspose Excel Workbook object with the provided excel template.
AsposeExcel.Workbook workBook = new AsposeExcel.Workbook(sourcePath);

//fetch file name of excel template without extension i.e. asset id
fileName = Path.GetFileNameWithoutExtension(workBook.FileName);

//define the temporary image format.
imageFileExtension = ".bmp";

//initializing image saving options and defining the image format.
Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
options.ImageFormat = System.Drawing.Imaging.ImageFormat.Bmp;
options.OnePagePerSheet = false;

//initializing sheet render object with first sheet in the workbook
Aspose.Cells.Rendering.SheetRender renderImage = new Aspose.Cells.Rendering.SheetRender(workBook.Worksheets[0], options);

//looping through all the pages in the first sheet.
for (int i = 0; i < renderImage.PageCount; i++)
{
renderImage.PageCount = 1;

//creating the temporary bmp file in the temp folder
renderImage.ToImage(i, tempFolderPath + @"\" + fileName + "_Bmp" + ++imgCounter + imageFileExtension);
}

Last line renderImage.ToImage throws an Out Of memory exception. Could you please help here as soon as possible as this is a production critical tool and I can't spend much time debugging and finding out the root cause. Attached is the sample excel file for which it fails to render image.

Hi,


Thanks for providing us template file and sharing the sample code.

After an initial test, I observed the issue for both files (you attached) as you mentioned by converting
any file to Image format. I got the exception:

“Out of memory” on the line i.e. SheetRender.ToImage().

I have logged a ticket with an id “CELLSNET-41956” for your issue. We will look into your issue to figure it out soon.

Thank you.

Hi,

Do we have any update on this. If you haven't raised it on high priority, please raise the priority now. Our work is blocked due to this.

Regards,

Karunish

Hi,


Well, I checked the status of your issue, it is still open and is not resolved yet. However, I have logged your comments/concerns to attach against your issue “CELLSNET-41956” and asked the concerned developer to update on it or share an eta (if possible). Once we receive an update on it, we will let you know here.

PS, Your issue is logged as a Normal user. You can consider to log it as a Priority or Enterprise user by purchasing the Priority or Enterprise Support to escalate your issue officially. However, purchasing enhanced support does not always guarantee a fix. Please read more about the enhanced support at the following link:
http://www.aspose.com/corporate/services/support-options.aspx


Thank you.

Hi Amjad,

We already purchased license for Aspose.Total on 1/8/2013 and I have order ID with me. But I don't know if this is the right forum to share order related information. Could you guide me how I can put this ticket in higher priority using our enterprise account or do I have to open a new ticket using the enterprise account. If so could you please guide how to approach as a enterprise account.

Regards,

Karunish

Hi,

Thanks for your posting and using Aspose.

Please login with your Enterprise Account and create thread in Enterprise Forum and give the reference of this thread there. We will then increase the priority of this issue as Enterprise Priority and will also link your Enterprise thread with this issue.

Hi,

I really have no clue what credentials do I need to use to login as an Enterprise user. Could you please let me know the process and the link for Enterprise forum as well. I just have the order confirmation email with me which contains the Order Id.

Also do we have any updates for the fix of the above.

Regards,

Karunish

(v-karora@microsoft.com)

Hi,

Thanks for your posting and using Aspose.Cells.

Please post your question on Aspose.Purchase forum. Aspose.Purchase team will guide you asap.

http://www.aspose.com/community/forums/aspose.purchase/220/showforum.aspx

Hi,


Please download and try this fix: Aspose.Cells for .NET v7.5.3.2 and let us know your feedback.


Your issue should be fixed in it.


Thanks,

Thanks Amjad,

The provided Aspose.Cells dll solved my problem for the previously attached excel files. But it is still not working for the new attached excel file. It gives some formula related error.

Regards,

Karunish

(v-karora@microsoft.com)

Hi,


Well, I have tested your issue using your code segment with your newly attached file(s), I found some formula(s) error while opening the files, I got the error using your first file:
E.g

“Error in Cell: E3-Invalid formula:“SUMIF(הוצאות[להוסיף לסה"כ?],“כן”,הוצאות[סכום])”.”

I think the reason is as you do not use English while specifying formulas, I am afraid, Aspose.Cells does not support non-English formulas, see the topic for your reference:
http://www.aspose.com/docs/pages/viewpage.action?pageId=15565448

Anyways, I have reopenend your issue “CELLSNET-41956” again. Our concerned devloper will further evaluate your issue.

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

Thank you.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET v7.5.3.5, we have fixed your issue now.

Let us know your feedback.

Thank you.

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


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