标题: 写jexcel api公式,出现单元格都变成 a1 [打印本页]
作者: admin 时间: 2011-3-27 11:56 标题: 写jexcel api公式,出现单元格都变成 a1
用 jxl,来输出公式,比如 SUM(B4:H9) ,代码如下:
new jxl.write.Formula(x, y, "SUM(B4:H9)");
但打开excel时,这个单元格,都变成了 SUM(A1:A1), 晕, 下载最新版本 jexcel api 2.6.12,就没问题.
经分析代码,得知里面复制内容到剪贴板
代码:
public CellReference(String s, int row, int column)
{
if (s.startsWith("$[")) {
this.columnRelative = (this.rowRelative );
s = s.substring(2, s.indexOf(']'));
String[] subindex = s.split(",");
this.row = (Integer.parseInt(subindex[0]) + row);
this.column = (Integer.parseInt(subindex[1]) + column);
}
else {
column = CellReferenceHelper.getColumn(s);
row = CellReferenceHelper.getRow(s);
this.columnRelative = CellReferenceHelper.isColumnRelative(s);
this.rowRelative = CellReferenceHelper.isRowRelative(s);
}
}
其中下面两行,应该加 this.方为正解
column = CellReferenceHelper.getColumn(s);
row = CellReferenceHelper.getRow(s);
欢迎光临 杰表技术论坛 (http://bbs.jatools.com/) |
Powered by Discuz! 6.1.0 |