如何使用Cell获取Cell Reference? [英] How to get Cell Reference using Cell?

查看:290
本文介绍了如何使用Cell获取Cell Reference?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用来自CellReference的apache poi 3.11,我可以使用以下代码获取rowIndex和Column Index。

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());

但我的rowIndex和columnIndex是动态生成的,如何使用rowIndex和columnIndex获取CellReference?

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);


推荐答案

使用CellReference创建CellReference实例(int pRow, int pCol)CellReference类的构造函数,以及创建的实例的formatAsString方法。

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

这篇关于如何使用Cell获取Cell Reference?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆