Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Cell Reference using Cell?

I am using apache poi 3.11, from CellReference, I can get rowIndex and Column Index, using following code.

CellReference cr = new CellReference("A1");
row = mySheet.getRow(cr.getRow());
cell = row.getCell(cr.getCol());

But my rowIndex and columnIndex are generated dynamically, how can I get CellReference using rowIndex and columnIndex?

XSSFRow row = mySheet.getRow(rowIndex); 
XSSFCell cell = row.getCell(columnIndex);
like image 233
2787184 Avatar asked Oct 13 '15 06:10

2787184


1 Answers

Create a CellReference instance using the CellReference(int pRow, int pCol) constructor of the CellReference class, and the formatAsString method of the created instance.

like image 143
Peter Salomonsen Avatar answered Sep 29 '22 06:09

Peter Salomonsen