开发者

How to read custom file properties in c#

开发者 https://www.devze.com 2023-01-02 20:38 出处:网络
I\'m looking for a way to read document properties in C#.I\'v开发者_如何学编程e heard about dsofile.dll, but it seems like an old COM wrapper, and was wondering if there is something more modern for t

I'm looking for a way to read document properties in C#. I'v开发者_如何学编程e heard about dsofile.dll, but it seems like an old COM wrapper, and was wondering if there is something more modern for the .NET framework/C#. What I'm actually reading is not an office document file, but a Solidworks .SLDDRW file, that has Custom properties. You can view and change these in Windows Explorer by right-clicking on the file, and going to the Properties window, Custom tab.

Anyone know how to read these custom properties in C# / .NET 3.5?

Thanks!


The SolidWorks system uses the OLE Document Properties API. As you've pointed out, Microsoft offers a sample, DSOFile.dll, that allows you to access these properties:

http://support.microsoft.com/kb/224351

The SolidWorks API also has robust support for these properties, but you have to load Solidworks to use the API, so it's not always the ideal solution. Note that if the file is already open in Solidworks, however, you won't be able to edit custom properties using DSOfile.dll.

The simple answer to your question is that there isn't an updated API for these properties; much the same way many other legacy APIs (DDE, for example) continue to appear in production environments, DSOFile suits the need and honestly wouldn't be entirely appropriate for update due to its fairly low-level nature. DSOFile, however, is perfectly capable of handling your needs and it works quite cleanly with .NET. The source is available and can be compiled to 64 bit if that is an issue for your users; it does mean you need a separate 64 bit install, but that's a small price to pay (plus SolidWorks isn't exactly cross-bitness-friendly to begin with).


If I understand you correctly, this thread has the answer for you:

Read/Write ‘Extended’ file properties (C#)

0

精彩评论

暂无评论...
验证码 换一张
取 消