Free Support Forum - aspose.com

Retrieving linked Cell from control

Hello,

I am looking for a way to retrieve the Cell represented by the getLinkedCell() method of a control such as RadioButton or ComboBox. Is there any easy way to retrieve this?

Thanks,
Sean

Hi,


When you use getLinkedCell() method it will give you the corresponding cell’s name/address which is controls’s linked cell. Now you may obtain the Cell object based on the cell’s name/address accordingly.

Thank you.


Hello,

Thanks for the response. I am unsure how to retrieve the Cell based off of the cell’s address. How do I retrieve the cell based off of the address? For example, if the getLinkedCell() method returns “Sheet1!$A$1”, how would I get the Cell from this address?

Thanks,
Sean

Hi,

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

You can use the following code to access your cell and its value. The code removes the sheet name part from the string and also remove the $ sign to get the cell’s name.

After that it uses worksheet.getCells().get() method to access the cell by its name.

Java


//String returned by getLinkedCell() method

String returnedString = “Sheet1!$A$1”;


//Split and parse it to access the cell’s name

String[] array = returnedString.split("!");

String cellName = array[1].replace("$", “”);


//Access your cell with cell’s name from your worksheet

Cell cell = worksheet.getCells().get(cellName);


//Print your cell value on console

System.out.println(cell.getStringValue());

Ok, thanks.

Hi,

Thanks for considering Aspose.Cells.

You are welcome. The above code will resolve your issue. Let us know if you still face any issue, we will be glad to assist you further.

Besides, we will recommend you to download and try the offline Aspose.Cells for Java demos. It will help you to be quickly familiar with Aspsoe.Cells for Java API(s).