如何获得当前或集中的单元格值?

编程入门 行业动态 更新时间:2024-10-09 15:18:41
本文介绍了如何获得当前或集中的单元格值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我选择一个单元格时,它会聚焦在相应的列上.因为无论焦点发生变化,我都需要在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.

更多推荐

如何获得当前或集中的单元格值?

本文发布于:2023-11-23 01:00:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619541.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何获得   单元格

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!