Gembox - 获取ExcelCell的地址 [英] Gembox - get address of ExcelCell

查看:199
本文介绍了Gembox - 获取ExcelCell的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在评估Gembox作为Aspose的替代品。我想我会失明,因为我不能做的一件事很容易得到ExcelCell的地址(例如B4)。

We are evaluating Gembox as a replacement for Aspose. I think I am going blind as one thing I cannot do is easily get the address (e.g. "B4") of an ExcelCell.

例如,当迭代单元格,我们可能会遇到一个意想不到的价值,并想告诉用户错误在哪里。

For example, when iterating through the cells, we may encounter an unexpected value and would like to tell the user where the error is.

var dodgyCell = sheet.Cells[rowIndex, colIndex];

我发现最好的解决方法是创建一个单元格的CellRange,然后使用startposition。即:

The best workaround I have found if to create a CellRange of one cell and then use the startposition. i.e.:

var cr = sheet.Cells.GetSubrangeAbsolute(rowIndex, colIndex, rowIndex, colIndex);
var message = "Dodgy value was found in cell " + cr.StartPosition

当然有必须是一个更简单的方法?

Surely there has to be an easier way?

干杯

推荐答案

原创海报已经弄清楚了答案。不幸的是它不是很明显,所以这里再次:

Seems that Original Poster has figured out the answer. Unfortunately it is not well visible so here it is again:

要将行和列索引转换为位置字符串(A1,BN27等)使用静态方法 CellRange.RowColumnToPosition(int row,int column)

To convert row and column index to position string ("A1", "BN27", etc.) use static method CellRange.RowColumnToPosition(int row, int column)

更新

在较新版本的GemBox.Spreadsheet(3.9和ExcelCell还有一个额外的名称属性,返回单元格的地址。

UPDATE
In newer versions of GemBox.Spreadsheet (3.9 and above) the ExcelCell has an additional Name property which returns cell's address.

这篇关于Gembox - 获取ExcelCell的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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