如何使用 C# 和 Excel 互操作访问 excel 属性,例如创建日期
How can I access excel properties like creation date with C# and Excel interop
我必须使用 C# 和 Microsoft.Office.Interop.Excel.Worksheet
提取 excel 文件的创建日期。
我将使用
获取属性
object props = myworkbook.CustomDocumentProperties;
现在我不确定如何从这个对象中获取创建日期。
可以在 BuiltinDocumentProperties 属性 中找到 Creation Date
,其中 returns 代表所有 built-in 文档属性的 Microsoft.Office.Core.DocumentProperties
集合对于工作簿。
Microsoft.Office.Core.DocumentProperties properties;
properties = (Microsoft.Office.Core.DocumentProperties)Globals.ThisWorkbook.BuiltinDocumentProperties;
Microsoft.Office.Core.DocumentProperty prop;
prop = properties["Creation Date"];
有关详细信息,请参阅 How to: Read from and write to document properties。
我必须使用 C# 和 Microsoft.Office.Interop.Excel.Worksheet
提取 excel 文件的创建日期。
我将使用
object props = myworkbook.CustomDocumentProperties;
现在我不确定如何从这个对象中获取创建日期。
可以在 BuiltinDocumentProperties 属性 中找到 Creation Date
,其中 returns 代表所有 built-in 文档属性的 Microsoft.Office.Core.DocumentProperties
集合对于工作簿。
Microsoft.Office.Core.DocumentProperties properties;
properties = (Microsoft.Office.Core.DocumentProperties)Globals.ThisWorkbook.BuiltinDocumentProperties;
Microsoft.Office.Core.DocumentProperty prop;
prop = properties["Creation Date"];
有关详细信息,请参阅 How to: Read from and write to document properties。