Author Topic: Visio add-in project templates  (Read 20845 times)

0 Members and 1 Guest are viewing this topic.

Nikolay

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Visio add-in project templates
« on: November 27, 2014, 03:47:00 PM »
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
« Last Edit: November 27, 2014, 03:51:07 PM by Nikolay »

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2786
    • Paul Herber's website
Re: Visio add-in project templates
« Reply #1 on: November 27, 2014, 03:49:27 PM »
Brilliant stuff, Nikolay. Thanks.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

Nikolay

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Re: Visio add-in project templates
« Reply #2 on: November 27, 2014, 04:58:01 PM »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2786
    • Paul Herber's website
Re: Visio add-in project templates
« Reply #3 on: November 28, 2014, 11:30:21 AM »
Can't use it myself, unfortunately, as I've uninstalled Visual Studio here completely.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

Yacine

  • Hero Member
  • *****
  • Posts: 2612
Re: Visio add-in project templates
« Reply #4 on: November 28, 2014, 01:51:07 PM »
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.
« Last Edit: November 28, 2014, 03:06:40 PM by Yacine »
Yacine

Nikolay

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Re: Visio add-in project templates
« Reply #5 on: November 28, 2014, 02:24:38 PM »
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?
« Last Edit: November 28, 2014, 03:04:27 PM by Nikolay »

Yacine

  • Hero Member
  • *****
  • Posts: 2612
Re: Visio add-in project templates
« Reply #6 on: November 28, 2014, 03:15:53 PM »
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.
« Last Edit: November 28, 2014, 04:02:06 PM by Yacine »
Yacine

Yacine

  • Hero Member
  • *****
  • Posts: 2612
Re: Visio add-in project templates
« Reply #7 on: November 28, 2014, 04:09:58 PM »
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

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Re: Visio add-in project templates
« Reply #8 on: November 28, 2014, 04:38:23 PM »
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.
« Last Edit: November 28, 2014, 04:54:02 PM by Nikolay »

Nikolay

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Re: Visio add-in project templates
« Reply #9 on: December 07, 2014, 04:53:01 AM »
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

  • Hero Member
  • *****
  • Posts: 2612
Re: Visio add-in project templates
« Reply #10 on: December 07, 2014, 07:17:51 AM »
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?

« Last Edit: December 07, 2014, 07:19:23 AM by Yacine »
Yacine

Nikolay

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Re: Visio add-in project templates
« Reply #11 on: December 07, 2014, 11:10:07 AM »
Quote
PS: how can I de-install a plug-in?

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

Yacine

  • Hero Member
  • *****
  • Posts: 2612
Re: Visio add-in project templates
« Reply #12 on: December 07, 2014, 12:06:18 PM »
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

  • Hero Member
  • *****
  • Posts: 2612
Re: Visio add-in project templates
« Reply #13 on: December 07, 2014, 12:42:22 PM »
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.
« Last Edit: December 07, 2014, 05:13:31 PM by Yacine »
Yacine

Nikolay

  • Hero Member
  • *****
  • Posts: 811
    • UnmanagedVisio
Re: Visio add-in project templates
« Reply #14 on: December 07, 2014, 07:15:46 PM »
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..
« Last Edit: December 08, 2014, 09:01:53 AM by Nikolay »