打开应用程序时我无法获取 powerpoint 和 excel 的元数据,但我可以在 word 文件中获取元数据信息。如何在首次启动时获取 excel 和 powerpoint 的元数据信息
public string ReadWorkbookProperty(string propertyName)
{
try
{
DocumentProperties properties;
var wb = _activeBook;
if (wb is null)
{
return "";
}
properties = (DocumentProperties)wb.CustomDocumentProperties;
foreach (DocumentProperty prop in properties)
{
if (prop.Name == propertyName)
{
return prop.Value.ToString();
}
}
return null;
}
catch (Exception)
{
return null;
}
}