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

Free Support Forum - aspose.com

Files having Charts have large memory footprint while loaded for parsing

Hi,


Please look at the attached sample file having 20 charts for each sheets(2 sheets).

When we load this document it results in larger memory footprint 200MB plus and also takes almost 77-85 secs to convert 40 charts to image files.

Please suggest if there are any improved processed for doing this stuff?

Hi,

Thanks for your posting, files and using Aspose.Cells for Java.

I have loaded your file and it was loaded instantly using the latest version:

Aspose.Cells for Java 7.3.1


Below is my test code for your reference. Please see its output.

Please provide us your simple but complete runnable sample test code to replicate this issue with the latest version. We will soon look into it and help you asap.

Java

String filePath = "F:\\639KB%2bxls%2b02sheets_20Graphs_1710rows+(1).xls";

Workbook workbook = new Workbook(filePath);

System.out.println(Calendar.getInstance().getTimeInMillis());

Worksheet worksheet = workbook.getWorksheets().get(0);

System.out.println(Calendar.getInstance().getTimeInMillis());

Output:
1346251128765
1346251128765
Hi,

"Please look at the attached sample file having 20 charts for each sheets(2 sheets).

When we load this document it results in larger memory footprint 200MB plus and also takes almost 77-85 secs to convert 40 charts to image files."

Well, I think it is obvious that you need certain amount of memory for the big process i.e. converting charts to image files. I tested your case a bit, I think the loading time is fine (take only 2 secs) and it uses less amount of RAM with latest version v7.3.1. Also, it takes about 18 seconds but use certain memory (e.g 100MB to 150MB) to convert the charts in the first sheet to image files. Here is the sample code.
Sample code:

long startOpen = System.currentTimeMillis();
Workbook workbook = new Workbook("639KB%2bxls%2b02sheets_20Graphs_1710rows+(1).xls");
long StartelapsedTimeMillis = System.currentTimeMillis()-startOpen;
System.out.println("Opening (sec):" + StartelapsedTimeMillis/1000F);

ChartCollection charts = workbook.getWorksheets().get(0).getCharts();
//System.out.println(charts.getCount());

long startSave=System.currentTimeMillis();
for(int i=0;i<charts.getCount(); i++)
{
Chart chart = charts.get(i);

chart.toImage("testimgchart" + i + ".png");
}
long SaveelapsedTimeMillis = System.currentTimeMillis()- startSave;
System.out.println("Saving Images (sec):" + SaveelapsedTimeMillis/1000F);

Moreover, if you could open your file into MS Excel and take the print preview of the sheet, you would notice that it takes some time to give you the print preview of the sheet.

Please try our latest version v7.3.1 as Shakeel Faiz suggested and make sure that you have sufficient amount of RAM for the big processes.

We will also check if we can enhance it more regarding memory resources and minimize images conversion time a bit.

Thank you.


We currently have option in LoadOptions.setDataOnly property, when we use this, this misses out styled text too,


is there a way possible in some future/current version that it allows us to load the document “WithoutCharts” mode, i guess this will end up in minimum memory footprint and we can process the charts separately
Hi,

azeemyousaf:
We currently have option in LoadOptions.setDataOnly property, when we use this, this misses out styled text too...

This is true as when setting setDataOnly option all the drawing objects/shapes and style/formattings in the Excel file are excluded.

Thank you.

What about the “WithoutChart” loading option?

Hi,


We need to look into it and check its feasibility of the feature. If the feasibility report is OK, we can support this feature/option for your needs. We have logged a ticket with an id: CELLSNET-41013. We will analyze it first, once we have any update on it, we will let you know here.

Thank you.

While doing feasibility, please also consider having an option to get the chart’s properties without loading every dependency in the memory. We will need to get the chart properties (data range, line/series/bar properties) to generate charts on a separate service

Hi,


We have logged your further comments against your existing ticket into our Issue tracking system. Our relevant developer will also look into it as well.

thank you.

Hi,

Thanks for using Aspose.Cells for Java.

We have thoroughly looked into your issue. Splitting the charts from reading the excel file is complex and unnecessary. Actually, the charts use a small number of memory.

When convert chart to image, Aspose cost temporary memory. I think we can call gc() method to reduce the memory.

Please refer the attached java code.

Thanks, let me try this,


BTW, while profiling using jprofiler, i forced GC and it clears out major part of the memory

Hi,

Thanks for your input.

It’s good to know that major part of memory was cleared out.

Let us know if you face any issue, we will be glad to look into your issue and help/advise you asap.

Hi,


I am using ASPOSE Cells 7.4.3 and while converting a chart object to image, it throws index out of bound exception.

File is attached for reference

Sample Code

ChartCollection charts=pWorkSheet.getCharts();
Chart chart=charts.get(chartCounter);

ImageOrPrintOptions io= new ImageOrPrintOptions();
io.setImageFormat(ImageFormat.getPng());
io.setQuality(100);

ByteArrayOutputStream out = new ByteArrayOutputStream();

chart.toImage(out,io);


Hi,

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

We were unable to replicate this exception using the latest version: Aspose.Cells
for Java v7.4.3.1
with the following sample code.

If you still find a problem, then please provide us your runnable sample code replicating the exception with the latest version.

Java


String filePath=“F:\Shak-Data-RW\Downloads\2MB+xlsx+02sheets_40Graphs_1710rowspersheet.xlsx”;


Workbook workbook = new Workbook(filePath);

Worksheet pWorkSheet = workbook.getWorksheets().get(0);


ChartCollection charts=pWorkSheet.getCharts();

Chart chart=charts.get(0);


ImageOrPrintOptions io= new ImageOrPrintOptions();

io.setImageFormat(ImageFormat.getPng());

io.setQuality(100);


ByteArrayOutputStream out = new ByteArrayOutputStream();


chart.toImage(out,io);

Hi,


Sorry for getting back to you late.

This is to update you regarding the ticket logged earlier as “CELLSNET-41013”. The aforementioned issue has been resolved now. We will share the Download link for the fix/version here after ensuring the quality and incorporating other enhancements.

Thank you.

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


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

Hi,


Please see the following sample code for your reference that you may try with latest version/fix: v8.8.3.
e.g
Sample code:

LoadOptions options = new LoadOptions();
options.LoadDataFilterOptions = LoadDataFilterOptions.All & ~LoadDataFilterOptions.Chart;
Workbook workbook = new Workbook(Constants.sourcePath + “Book1.xlsx”, options);

Thank you.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET v16.11.7

See the sample code below that you may use with the new fix/version:

e.g

Sample code:


LoadOptions.LoadFilter = new LoadFilter(LoadDataFilterOptions.All & ~LoadDataFilterOptions.Chart);

Let us know your feedback.

Thank you.