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

Free Support Forum - aspose.com

On deleting first row of a Range, the Range is updated wrongly

I create a range from Row 9 Column … to Row 14 Column …

Now if I delete any row other than the first row(Row 9), the Range end row keeps decreasing by 1 , which is correct.

But if I delete Row 9, the updated Range becomes Row 8 to Row 13, which is wrong.
It should have been Row 9 to Row 13.

Code:

import com.aspose.cells.Range;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;

public class checkRange {

public static void main(String[] args) {

	Workbook wb = new Workbook();
	wb.getWorksheets().add("temp");
	Worksheet ws = wb.getWorksheets().get("temp");
	
	Range range = ws.getCells().createRange("A10:R15");
	ws.getCells().addRange(range);
	
	System.out.println("Range starting: "+range.getFirstRow());
	System.out.println("Range ending: "+(range.getFirstRow()+range.getRowCount()-1));
	
	ws.getCells().deleteRow(9);
	
	System.out.println("Range starting: "+range.getFirstRow());
	System.out.println("Range ending: "+(range.getFirstRow()+range.getRowCount()-1));

	
}

}

Output:

Range starting: 9
Range ending: 14
Range starting: 8
Range ending: 13

It should ideally have been:
Range starting: 9
Range ending: 14
Range starting: 9
Range ending: 13

@sandipanghosh111,

You are right as I evaluated your issue a bit. After an initial test, I am able to observe the issue as you mentioned by using your sample code. I found that on deleting first row of a range, the range is updated wrongly for starting row index. I have logged a ticket with an id “CELLSJAVA-42821” for your issue. We will look into it soon.

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

And the problem is also there when u insert a row at the starting position of the Range.

@sandipanghosh111,

We have also observed this issue and logged it with the ticket for our later reference.

@sandipanghosh111

This is to inform you that we have fixed your issue (logged earlier as “CELLSJAVA-42821”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@sandipanghosh111,

Please try our latest version/fix: Aspose.Cells for Java v19.1.4:

aspose-cells-19.1.4.zip

Let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-42821) have been fixed in Aspose.Cells for Java 19.2. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi