我需要解析word文档(97-2003)中的"author"-property。最好不使用单词COM-Object。我通过使用docx-nuget对.docx-document做了同样的事情,但它似乎不能处理旧的.doc格式。
我试过Spire.Doc,但免费版太有限(打不开大文件),付费版对我来说有点太贵了。
有可能做到这一点吗?如果是,我该如何打开并解析"author"-property呢?
发布于 2015-10-19 16:49:05
我们使用dsoFile.dll来读写文档文件中的属性。
https://support.microsoft.com/en-us/kb/224351
添加对Interop.DSOFile的引用
using DSOFile;
public static string GetAuthorFromFile(string filename)
{
var test = new OleDocumentProperties();
test.Open(filename, true, DSOFile.dsoFileOpenOptions.dsoOptionDefault);
return test.SummaryProperties.Author;
}请参阅:Why dsofile.dll still need Office Installation?
作为替代,您可以使用:http://officefileproperties.codeplex.com/,但是您还需要在应用程序中包含Office Interop。
https://stackoverflow.com/questions/30048831
复制相似问题