本文介绍了如何获得当前或集中的单元格值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我选择一个单元格时,它会聚焦在相应的列上.因为无论焦点发生变化,我都需要在excel工作表上获取Column值和Row值(行号).
如何通过代码完成相同的操作?
如何使用C#在VSTO excel中获取焦点或当前单元格的列值?
解决方案Excel.Range rng =(Excel.Range)this.Application.ActiveCell;//获取单元格值对象cellValue = rng.Value;//获取行和列的详细信息int row = rng.Row;int列= rng.Column;
这是一个快速入门演练./p>
When I select a cell, the respective column it gets focused. For I need to get the Column value and Row value (row #) on excel worksheet wherever focus changes.
How can I do the same through code?
How do I get the focused or current cell's column value in VSTO excel using C#?
解决方案 Excel.Range rng = (Excel.Range) this.Application.ActiveCell; //get the cell value object cellValue = rng.Value; //get the row and column details int row = rng.Row; int column = rng.Column;and here's a quick start walkthrough.
更多推荐
如何获得当前或集中的单元格值?
发布评论