Read Shape Data properties from .VSD using C#

Started by sbisher, May 24, 2021, 05:34:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sbisher

Hey everyone,

I am trying to determine if there are any open source C# libraries or solutions out there that enable the reading of legacy ".VSD" files without needing to open the Visio application. I understand that ".VSDX" files can be accessed programmatically via OpenXML or Microsoft based solutions: https://docs.microsoft.com/en-us/office/client-developer/visio/how-to-manipulate-the-visio-file-format-programmatically

Unfortunately, I am forced to work with the older .VSD file format. All I want to do is read the properties from the "Shape Data" table for each Shape in a .VSD file. I do not need to make any changes to the .VSD file.

I've found some stack overflow solutions explaining how to access shape data from .VSD files, but they require the instantiation of the Visio application: https://stackoverflow.com/questions/7780002/how-to-read-visio-document-content-in-c-sharp

I'm hopeful that the Visio experts here may have a suggestion for me to investigate. That, or if anyone knows for a fact that .VSD Shape Data properties can only be read by instantiating the Visio Application, then I can call quits on my search.

I can also provide additional information if needed. Thanks for taking the time to read this.

Nikolay

#1
The straightforward solution could be the Aspose.Diagrams (the license is something like $400 AFAIR)

There is also open source APACHE POI, but looks like one needs to be hardcore to put it to use  :)

Another open source option: libvisio (from LibreOffice). The "hardcoreness" applies here as well  :)
https://github.com/LibreOffice/libvisio (https://wiki.documentfoundation.org/DLP/Libraries/libvisio)

If I had a need to read binary Visio files, I'd buy the first one, I think.
I guess the developer's time to set up the environment to build the second or the third one, and then integrate it with C# (on windows - these are linux libraries), will cost more than $400

If you opt for (2) you may consider looking into something like IKVM: http://www.ikvm.net/ for glue
If you opt for (3) you can go for C++/CLI for example, or just plain interop.

Buy anyway I'm afraid that the final bill will not be low.

One more option maybe, undocumented Visio indexer DLL (the one Windows Search is using to index Visio stencils and diagrams)
It's installed with Visio but can be used without it, and from a server process (the indexer is a service). If you are not picky, and don't care much about license agreements, you could try to google in this direction.

Visisthebest

I did not realise the Aspose library could do all this, very cool!
Visio 2021 Professional

ncjackson112480

If it didn't have to be C#, I know someone who did it with PHP and even reading the files from a sharepoint online library (I believe).

Good luck.  When you can feel you almost can get to it, that can be so frustrating.

I could give you code to initiate the instance and extract that and write it somewhere then close the file and move on (I think) ... but I'm it would probably have to from Visual Studio or something that executed it as I only know how to load the template macro's and hit go, but some of my files have 50 models in them, so still not so bad.