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

Free Support Forum - aspose.com

Setting formula of one cell changes formula of different cell

While evaluating Cell.Java (which works great by the way!), I stumbled across the following issue:
Within my application I reset a cells formula via .setFormula(null), but this change also affects it’s neighbor cell. This only happened under certain conditions, but after some hours I was able to isolate the effect.
This effect occurs only if i get the value of an empty cell in the same row, but only if this empty cell is left of the other cells. It’s hard to explain, so please see the following minimal testcase:

public static void main(String[] args) throws Exception
{
	Workbook wb = new Workbook();
	Worksheet sheet = wb.getWorksheets().get(0);
	Cells cells = sheet.getCells();

	Row row= cells.getRows().get(1);
	row.get(2).setFormula("=1=1");
	row.get(3).setFormula("=1=2");
	
	Cell aCell = row.get(2);
	Cell bCell = row.get(3);
	
	// uncomment this line in see the effect
	// row.get(1).getStringValue();
	
	bCell.setFormula(null);
	System.out.println( aCell.getFormula()); //<-- this should be "=1=1"
}

If you uncomment the line containing “getStringValue()” you’ll receive “null” instead of the fomular. It doesn’t happen if you request the value of a cell of index 3 or up.

Tested with cell.java version 20.6, 19.12 and 19.10, all versions behave the same.

Can you confirm this is a bug?

@oklein,
We have observed the issue and logged it in our database for further investigation. We will write back here once any update is ready to share.

This issue is logged as
CELLSJAVA-43243-Formula could not be retrieved while changing formula of neighboring cell

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

The issues you have found earlier (filed as CELLSJAVA-43243) have been fixed in Aspose.Cells for Java 20.7. This message was posted using Bugs notification tool by Amjad_Sahi

@ahsaniqbalsidiqui
We testet the provided fix and can confirm it fixed our issue.
Thanks a million for your fast response and providing this fix so quickly!
Kind regards,
Oliver

@oklein,

Good to know that your issue is resolved by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.