它的名字访问Excel单元格 [英] Access excel cell by its name
问题描述
我试图Excel的单元格名称设置为一些自定义的名称,后来获得通过它的名字细胞。
是有一些现成的API调用要做到这一点,或者我应该怎么做,如果我在进入细胞和
工作表和单元格地址(即C2)的情况下,有工作表和单元名称的信息在命名的单元格的情况下。
I'm trying to set excel's cell name to some custom name and to later access that cell by its name. Is there some out of the box API call to do this, or how should I do this if I have information of worksheet and cell name in case of accessing cell and worksheet and cell address (i.e. C2) in case of naming the cell.
还用问,有没有获得绑定到特定单元格格式信息的方法吗?
(即当我访问细胞的名字我想回到单元格的值和该小区的一些格式属性,如果单元格是数字或文字,它是强调,等...)
Also to ask, is there a way to acquire formatting information that is bound to that specific cell? (i.e. When I'm accessing cell by name I want to return cell value and some formatting properties of this cell, if cell is number or text, is it highlighted, etc...)
问候,
弗拉基米尔Vajda
Vladimir Vajda
推荐答案
我想你可能会寻找范围(C2)
。
至于格式化信息,这是可以通过Excel对象模型的各种属性。请参见 http://msdn.microsoft.com/en-us/library/ff197454。 ASPX 了解详情。
As to formatting information, this is available through various properties of the Excel object model. See http://msdn.microsoft.com/en-us/library/ff197454.aspx for more information.
范围
键入(相对于范围
上面提到的索引属性),也暴露了一个名称
属性,它可以在代码中设置:
The Range
type (as opposed to the Range
indexed property referenced above) also exposes a Name
property, which you can set in code:
worksheet.get_Range("C2").Name = "fdafdfs"
worksheet.get_Range("fdafdfs").Select();
这篇关于它的名字访问Excel单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!