如何获取使用 Interop.Excel 的范围的第一个单元格坐标?
How do I get the first Cell coordinates for a range for using Interop.Excel?
我正在为我工作的地方 excel 开发一个小插件,我需要找到所选单元格范围的起始位置(x 和 y)。
这是一些代码:
using Excel = Microsoft.Office.Interop.Excel;
Excel.Range thisRange = thisSheet.Cells.Application.Selection.SpecialCells(
Excel.XlCellType.xlCellTypeVisible,
Type.Missing);
其中 thisSheet 是 Excel.Worksheet
。
我可以使用以下方法找到行数和列数:
int r = thisRange.Rows.Count;
int c = thisRange.Columns.Count;
但我试图找到所选范围内第一个单元格的 X 和 Y 位置。有人可以帮忙吗?
谢谢
我可以通过使用 Range.Row and Range.Column
来实现这一点
我正在为我工作的地方 excel 开发一个小插件,我需要找到所选单元格范围的起始位置(x 和 y)。
这是一些代码:
using Excel = Microsoft.Office.Interop.Excel;
Excel.Range thisRange = thisSheet.Cells.Application.Selection.SpecialCells(
Excel.XlCellType.xlCellTypeVisible,
Type.Missing);
其中 thisSheet 是 Excel.Worksheet
。
我可以使用以下方法找到行数和列数:
int r = thisRange.Rows.Count;
int c = thisRange.Columns.Count;
但我试图找到所选范围内第一个单元格的 X 和 Y 位置。有人可以帮忙吗? 谢谢
我可以通过使用 Range.Row and Range.Column
来实现这一点