Free Support Forum -

copyRange throws java.lang.OutOfMemoryError: Java heap space


I have attached the tempalte file. The error has occured in the following code:


public void copyRangeTest() throws Exception {

Workbook book = new Workbook("c:\\temp\\test.xlsx");

Worksheet sheet = book.getWorksheets().get(0);

Cells cells = sheet.getCells();

Range range = cells.createRange(14, 0, 86, 39);

Range source = cells.createRange(13, 0, 1, 39);

PasteOptions options = new PasteOptions();


range.copy(source, options);


Output looks as follows:

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(
at java.util.ArrayList.grow(
at java.util.ArrayList.ensureExplicitCapacity(
at java.util.ArrayList.ensureCapacityInternal(
at java.util.ArrayList.add(
at com.aspose.cells.b.a.a.ze.a(Unknown Source)
at com.aspose.cells.HyperlinkCollection.a(Unknown Source)
at com.aspose.cells.HyperlinkCollection.a(Unknown Source)
at com.aspose.cells.Range.a(Unknown Source)
at com.aspose.cells.Range.copy(Unknown Source)

Could you scrutinize the issue and fix the problem ASAP?



Thanks for your posting and using Aspose.Cells.

Please download and use the latest version: Aspose.Cells for Java (Latest Version) it works fine with your sample code and source excel file and does not throw any exception.


We use Aspose.Cells for Java v8.4.2.2. And so in the stable branch of product it is imposiible to use v8.4.2.8 as it has significant changes since version and above. These changes cannot be used as part of stable pack as requires a lot of fixes based on Aspose API modifications.

Could you provide version before ( or that has copyRange bug fixed to eliminate destabilization of stable branch of our product?



Thanks for your posting and using Aspose.Cells.<br> is just a very close version to or There are not any intermediate versions that we could test with and provide it to you. So you will have to use the latest version. Also, you can wait for the next java official version 8.5.0 which will be released in this week or next week.

Please remember we always fix the issues if they occur in the latest versions only. If some issue is occurring in the older version and not occurring with the latest version, we do not fix that issue because it is already fixed in the latest version.