Excel 四处走动
如果您有对单元格的引用,是否可以在 Excel 工作表中四处走动? 像这样
Microsoft.Office.Interop.Excel.Range cellWalker = mfe.GetMyCell(Mysheet);
cellWalker = cellWalker.GoUpOneRowButKeepColumn();
cellWalker = cellWalker.GoDownOneRowButKeepColumn();
cellWalker = cellWalker.GoLeftOneColumnButKeepRow();
cellWalker = cellWalker.GoRightOneColumnButKeepRow();
?
问候斯特凡
Is there a way of walking around in a Excel sheet if you have a reference to a cell ?
Like this
Microsoft.Office.Interop.Excel.Range cellWalker = mfe.GetMyCell(Mysheet);
cellWalker = cellWalker.GoUpOneRowButKeepColumn();
cellWalker = cellWalker.GoDownOneRowButKeepColumn();
cellWalker = cellWalker.GoLeftOneColumnButKeepRow();
cellWalker = cellWalker.GoRightOneColumnButKeepRow();
?
Regards Stefan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该文档说否。您可以通过将接口包装在您自己的对象中来自己实现此类功能。您可以将这些方法写入对象中,然后使用 Range 和 Cell 属性来导航工作表。
概念性(未经测试,但“一般要点”示例)
The documentation says no. You can probably implement such functionality yourself by wrapping the Interface within your own object. You can write those methods into the object, then use the Range and Cell properties to navigate the sheet.
Conceptual (untested, but "general gist" example)
Range.Offset 属性将为您执行此操作。例如
The Range.Offset property will do this for you. E.g.