如何在Excel工作表中使用C#获取当前或聚焦的单元格值 [英] How to get current or focussed cell value in Excel worksheet using C#

查看:703
本文介绍了如何在Excel工作表中使用C#获取当前或聚焦的单元格值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我通过一个C#代码,在VSTO excel中,我选择一个单元格,相应的列被集中。我需要在excel工作表上获取列值(哪个列)和行值(哪个行号),无论我在哪里。



请帮助我通过代码获得相同的。



而且我也想用C#学习VSTO Excel。建议我一些很好的电子书免费下载和任何网页链接相同。



如何使用C#获取聚焦或VSTO excel中当前单元格的列值

解决方案

  Excel.Range rng =(Excel.Range)this.Application.ActiveCell; 

//获取单元格值
对象cellValue = rng.Value;

//获取行和列详细信息
int row = rng.Row;
int column = rng.Column;

这里是一个快速入门的演练


Please help me through a C# code that In VSTO excel whereever i selected a cell the respective column gets focussed. I need to get the Column value(which column) and row value(which row no) on excel worksheet wherever i focussed.

Please help me to get the same through code.

And also i would like to learn VSTO Excel using C#. Suggest me some good ebooks free downloadable and any web links for the same.

how to get focussed 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.

这篇关于如何在Excel工作表中使用C#获取当前或聚焦的单元格值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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