News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Visio add-in project templates

Started by Nikolay, November 27, 2014, 08:47:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Nikolay

Hello all,

Have just published a bunch of project templates to create a Visio Addin with Visual Studio:

1. COM Addin (C#, works with the free Visual Studio 2013 Community Edition)
https://visualstudiogallery.msdn.microsoft.com/8c88a77d-ac36-4a03-a39e-4472ba612bee

2. VSTO Addin (C#, requires VSTO)
https://visualstudiogallery.msdn.microsoft.com/d73b91cf-eaf3-4d54-acb5-4a85bec3c1fe

3. C++ Addin. Same thing, but in unmanaged C++ (ATL)
https://visualstudiogallery.msdn.microsoft.com/a9d68071-a0b8-40d1-8ada-fb0f6891c9cb

All of them support:
-       Installer project
-       User interface to start with
-       A TaskPane (not really a "TaskPane", but a docking panel), and a toggle button to control it
-       Custom images for the buttons.
-       State (enabled/disabled) for the buttons.
-       Optional support for legacy Visio version (2003/2007; command bar with buttons)

Here is the screenshot of "Create new project":


Image of what is the result (checkboxes set like on the picture above):


In Visual Studio:


Source code at github:
https://github.com/nbelyh/VisioPanelAddinVSTO
https://github.com/nbelyh/VisioPanelAddinCOM

Paul Herber

Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Nikolay

Paul, thanks!

Hope that it will work properly and will be useful!
P.S. After publishing found an issue with VSTO project ("No such interface") - should be fixed now. :)

Paul Herber

Can't use it myself, unfortunately, as I've uninstalled Visual Studio here completely.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Yacine

#4
Hi Nikolay,
from me also the highest appreciation and thanks for the contribution.

I tried the COM version and somehow got stuck, I managed to get till the intaller in "C:\Users\Yacine\Documents\Visual Studio 2013\Projects\VisioPanelAddin1\VisioPanelAddin1\Setup\bin\Debug\x64" and it runs, but I cannot find it in Visio itself.
I seem to be missing an important point.
Yacine

Nikolay

#5
Try to just change to x86 configuration. Most probably that's it. Dont know why Visual Studio sets x64 targets by default.
Just select platform to be x86 in the combo box in VS and rebuild. You should get the installer in the x86 folder.



The x64 build targets Visio x64...

Probably need to add check for x86/x64 Visio version somewhere in installer.
Also the installer has no UI now, that's probably not okay, would it be better if it had?

Yacine

#6
That was the answer.
Thank you.

UI? sure, but a kind of instruction file (readme) could suffice as first help.
Myself and many other forum members would certainly also appreciate a more substantial article or a youtube video on building visio add-ins.

There are still those virtual beers floating around (http://visguy.com/vgforum/index.php?topic=6012.msg24702;topicseen#msg24702).
I owe you a barrel.
Chris is near Munich. I'll be in charge in Dusseldorf and surroundings. Tell me when ever you come nearby.
Yacine

Yacine

Sorry, but here is already the second question.
Having modified the form in VS and rebuilt the solution, how do I refresh it?
There is still the previous solution showing up.
Yacine

Nikolay

#8
Probably now the installed version is always started.

I do it as following (so that modifications are applied immediately, and you are able to debug / set breakpoints / step through code / etc)

In the Addin's project settings, set the "Register for COM Interop" checkbox.
Also set to start Visio as executable (see below), so the VS does not complain that it cannot start a DLL, but just start Visio.
Rebuild. Run (F5).

Then VS will register the debug version, and Visio will load it instead of the installed one.
Note that you'll need to restart Visual Studio as Administrator do do that:





When you are done debugging, build the installer.

Nikolay

Updated:

- Now Visual Basic projects are also supported
- Improved in points encountered by Yacine: now the platform of the installed Visio is selected by default, and Visio is selected as executable to debug by default
- Added default UI to the installer
- Fixed issue with some configurations (error on project creation if some specific combination of checkboxes is selected)

Yacine

#10
Just some quick thoughts before even testing the new uploads.


- VB.NET instead of C# is certainly something that will attract more people.
- With your project you are bringing to the visio community a possibility to tweak visio in a much richer and deeper way.
- Being a novice in Visual Studio, I am still struggling with basic structures. I mean knowledge about where (and how) to implement a "visio" class, where one would store the document, page and shapes data; the routines handling the shape inspection and the modification of shape cells; etc.


Regards,
Yacine


PS: how can I de-install a plug-in?

Yacine

Nikolay

Quote
PS: how can I de-install a plug-in?

From Visio: add-remove programs, uninstall.
From Visual Studio: Tools -> Exfensions & Updates -> Uninstall.

Yacine

Found it in the control center (is that the right name in english?).


But I found several copies of the addin. That should not happen.
Yacine

Yacine

#13
Hi Nikolay,
it's embarassing for me, because you must get the impression that I am too lazy to search.  :-\


Do you have an idea about what could have caused the attached error?


Basically, Visio starts just fine, no errors, but no toolbar is created.


Update: I messed too much around. After having desintalled the plug-in, I manually deleted also the toolbar. Now neither VB nor C# create a new toolbar. ??? ???


Update 2: If I install the VB plug-in, then I get the toolbar, but there doesn't seem a way to get it in debug mode.
Yacine

Nikolay

#14
Hi Yacine.

Sorry for the inconvenience, not quite sure what the issue is.
You should be able to debug the COM addin as following:

1. Uninstall everything (from add-remove programs).
2. Start Visual Studio as administrator
2. Rebuild the project.
4. Install the project.
5. Set the checkbox "Register for COM interop" in the project settings.
6. Rebuild the project again.
7. Press F5 to start debugging.

Which operating system / Visio version do you have?
Tomorrow I'll try to make a short Video how to make it work..

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 437 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1275KB.
Tokens: post-login.
Cache hits: 13: 0.00165s for 26,740 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]