有没有简单的方法来获得“A1”?使用 Excel COM 接口的范围的样式坐标?
我正在尝试让我的程序将数据转储到 Excel 电子表格中。目前,它只是将信息放入正确的单元格中,根据我的代码中的需要计算任何计算值。我真正想做的不是写出计算值,而是将 Excel 公式写到包含计算值的单元格中。这样,如果我将 Excel 文档提供给某人,他们可以更改其中的数据,并且计算值将按预期更新。
问题是我不知道如何获取 Excel 期望的“A1”样式坐标。基本上,我希望有类似的东西可用:
calculatedCell.Value = string.Format("=SUM({0})", range.Coordinates);
我知道我可以获取范围的行和列索引,并使用这些索引我可以自己评估坐标,我只是希望有一种预先打包的方法它。
I'm trying to get my program to dump out data into an Excel spreadsheet. At the moment, it simply puts the information into the proper cell calculating any calculated values as needed within my code. What I would really like to do is instead of writing out the calculated values is to write out the Excel formulas to the cells that contain calculated values. That way, if I give the Excel document to someone, they can change the data in it and the calculated values will update as expected.
The problem is that I don't know how to get the "A1" style coordinates which Excel would expect. Basically, I'm hoping that there's something like this available:
calculatedCell.Value = string.Format("=SUM({0})", range.Coordinates);
I know I can get the row and column index for the range, and using those I could evaluate the coordinates myself, I was just hoping there was a pre-packaged way of doing it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该有一个
地址<
Range
上的 /code>属性。
试试这个:
There should be an
Address
property onRange
.Try this: