【发布时间】:2013-02-05 17:14:31
【问题描述】:
我正在尝试通过使用属性名称来访问工作表上的自定义属性,但似乎不支持(至少在 C# 中不支持,我看到其他人报告说它在 VB 中有效,文档也说所以)。有人可以确认这在 C# 中不起作用吗?这是示例代码:
activeWorkSheet.CustomProperties.Add("Test", 123);
// Accessing by index works, but by name it doesn't.
// The documentation says access by name should be possible
var works = activeWorkSheet.CustomProperties.Item[1].Value;
var doenstWork = activeWorkSheet.CustomProperties.Item["Test"].Value;
我知道解决方法只是一种遍历所有属性并找到正确属性的方法,但我真的很想避免任何额外的开销。
【问题讨论】:
标签: c# excel ms-office office-interop