0
votes

I wrote a small C# Visio Addin which should export the current page of the Visio document as *.svg whenever the open Visio file is saved:

Application.ActivePage.Export("C:\\Users\\x\\Desktop\\example.svg");

Unfortunately, when it runs this line it gets stuck in Visio with a window displaying "Preparing to save..." and a progress bar at 88%.

I tried several things (e.g. different target paths, running as administrator etc.) but nothing helped. It always gets stucked there and I can only click abort then.

When I do the same manually in Visio (Save as svg) then it works without any issue.

The same code with e.g. *.png instead of *.svg works well.

Do you have any idea what could be the problem here?

Thanks.

1
Have you tried a different file extension? - Rand Random
Does it do this for every input file, or just one? Can you look using ProcMon what's happening? - CodeCaster
@RandRandom Yes, the same codee with e.g. *.png works well. - theNewOne
Have you tried saving as .svg with a simple page of just one rectangle? - Paul Herber
Just a guess, maybe there is a progress dialog in the background, or some sort of question dialog? Try clicking ALT+TAB. - Nikolay

1 Answers

1
votes

Solved it by running the above code in the event Application.BeforeDocumentSave instead of Application.DocumentSaved ...but no idea why it works now.