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

Free Support Forum - aspose.com

OutOfMemory error during image treatment

Hi,



“OutOfMemory” error raised during treatment of an image in our application.



We manage hundred of images, with no problem, and we don’t know why these ones generate errors.



I have attached the document.



Our implementation :



“Try

Dim szPDFFile as String = “C:\Dev\SA_IRD_PartA_54.53.F008_SECT41_iss1_2016-01-27.xlsm”

Dim wb As Aspose.Cells.Workbook = New Aspose.Cells.Workbook(szPDFFile)

Dim sb As Aspose.Cells.Worksheet = wb.Worksheets(0)

Dim p_o_Range As Aspose.Cells.Range = sb.Cells.CreateRange(“B6:AO45”)



p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.TopBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty)

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.BottomBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty)

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.LeftBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty)

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.RightBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty)



sb.PageSetup.ClearHeaderFooter()

sb.PageSetup.FooterMargin = 0

sb.PageSetup.HeaderMargin = 0

sb.Cells.ClearFormats(5, IRDEditorTools.CheckRules.GetColNum(“B”) - 1, 44, IRDEditorTools.CheckRules.GetColNum(“B”) - 1)

sb.Cells.ClearFormats(40, IRDEditorTools.CheckRules.GetColNum(“AL”) - 1, 44, IRDEditorTools.CheckRules.GetColNum(“AO”) - 1)

sb.Cells.ClearContents(40, IRDEditorTools.CheckRules.GetColNum(“AL”) - 1, 44, IRDEditorTools.CheckRules.GetColNum(“AO”) - 1)



sb.PageSetup.LeftMargin = 0

sb.PageSetup.RightMargin = 0

sb.PageSetup.TopMargin = 0

sb.PageSetup.BottomMargin = 0



Dim options As Aspose.Cells.Rendering.ImageOrPrintOptions = New Aspose.Cells.Rendering.ImageOrPrintOptions()

options.OnePagePerSheet = True

options.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg

options.Quality = 75

options.HorizontalResolution = 300

options.VerticalResolution = 300



sb.PageSetup.PrintArea = “B6:AO45”



Dim sr As Aspose.Cells.Rendering.SheetRender = New Aspose.Cells.Rendering.SheetRender(sb, options)

sr.ToImage(0, szPDFFile + “.jpg”)



Catch ex As Exception

Dim aa As String = ex.Message

End Try”



Thanks for the support

Hi,


Thanks for the template file and sample code.

After an initial test, I observed the issue as you mentioned by using your sample code (I have converted it to C#) with your template file. I found OutOfMemory error during image rendering, I have to comment some lines involving “IRDEditorTools” object or its relevant attributes for which I am not sure about it or its data:
e.g
Sample code:

string szPDFFile
= “e:\test2\SA_IRD_PartA_54.53.F008_SECT41_iss1_2016-01-27.xlsm”;<o:p></o:p>

Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(szPDFFile);

wb.Settings.MemorySetting = MemorySetting.MemoryPreference;//This does not make any difference.

Aspose.Cells.Worksheet sb = wb.Worksheets[0];

Aspose.Cells.Range p_o_Range = sb.Cells.CreateRange("B6:AO45");

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.TopBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty);

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.BottomBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty);

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.LeftBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty);

p_o_Range.SetOutlineBorder(Aspose.Cells.BorderType.RightBorder, Aspose.Cells.CellBorderType.None, System.Drawing.Color.Empty);

sb.PageSetup.ClearHeaderFooter();

sb.PageSetup.FooterMargin = 0;

sb.PageSetup.HeaderMargin = 0;

//sb.Cells.ClearFormats(5, IRDEditorTools.CheckRules.GetColNum("B") - 1, 44, IRDEditorTools.CheckRules.GetColNum("B") - 1);

//sb.Cells.ClearFormats(40, IRDEditorTools.CheckRules.GetColNum("AL") - 1, 44, IRDEditorTools.CheckRules.GetColNum("AO") - 1);

//sb.Cells.ClearContents(40, IRDEditorTools.CheckRules.GetColNum("AL") - 1, 44, IRDEditorTools.CheckRules.GetColNum("AO") - 1);

sb.PageSetup.LeftMargin = 0;

sb.PageSetup.RightMargin = 0;

sb.PageSetup.TopMargin = 0;

sb.PageSetup.BottomMargin = 0;

Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

options.OnePagePerSheet = true;

options.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;

options.Quality = 75;

options.HorizontalResolution = 300;

options.VerticalResolution = 300;

sb.PageSetup.PrintArea = "B6:AO45";

Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sb, options);


sr.ToImage(0, szPDFFile + “.jpg”);//Exception
occurred.


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


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

Thank you.

Hi,


This is to inform you that your issue (logged earlier as “CELLSNET-45350”) has been fixed now. We will soon provide you the fixed version (Download link can be shared here in the next 3-5 days or so) after performing QA and incorporating other enhancements and fixes.

Thank you.

The issues you have found earlier (filed as CELLSNET-45350) have been fixed in Aspose.Cells for .NET 17.5.


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

Hi,


We did fix the OutOfMemory issue in v17.5. But we found there are some issues in the rendered resultant image, We have now logged a subtask ticket with an id (“CELLSNET-45353” - Images not right and an extra line added while rendering Sheet to Image) for it,

Once we fix this issue, we will update you here.

Thank you.