Accessing CustomProperties on Worksheet with Name

给你一囗甜甜゛ 提交于 2019-12-01 21:47:13

Can someone confirm that this is not working in C#?

Just tried with Office 2013 preview and version 15 of the Interop API, and I can confirm that this does not work in C# (throws a COMException with the message of "Type mismatch").

I have checked the documentation, which states that it should be perfectly legal to use the key name as index for the Item indexer - from the docs for the CustomProperties.Item property, it states that the following indexer is available:

CustomProperty this[
    Object Index
] { get; }

... and in the following text, the docs states:

Parameters

Index

Type: System.Object

Required Object. The name or index number of the object.

... so since the documentation states that the name is a valid key, the behavior we experience might likely be a bug.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!