none
Help upgrading (from visio 2010) drawing objects on Org chart in Viso 2013 RRS feed

  • Question

  • Hello,

    I am developing my first VSTO application and found this tutorial that I thought would be a good start. It actually was very helpful but I am using Visio 2013 and some parts are not working exactly as expected. I'm sure this is because the tutorial was written to Visio 2010.

    http://www.codeproject.com/Articles/109558/Creating-VISIO-Organigrams-using-C

    I am getting an error    ComException: Object name not found.    on this line:

    Microsoft.Office.Interop.Visio.Master position = doc.Masters.get_ItemU(box.Type.ToString());

    Googling get_ItemU comes up with this (http://msdn.microsoft.com/en-us/library/cc160744.aspx) that shows the above line should work. I just fancied things up a bit with an enumeration.

    public enum BoxTypes
        {
            Position,
            Executive,
            Manager,
            Consultant,
            Assistant
        }


    Well I noticed that the shapes in Visio 2013 are called Executive Belt, Position Belt etc. I changed to these names but same result. I hardcoded the values like in the tutorial still get the error.

    However intellisense says it takes an object parameter so I tried passing the whole object and it actually worked!

    Microsoft.Office.Interop.Visio.Master position = doc.Masters.get_ItemU(box.Type);

    Right up to when I goto work with a child object. In that case neither the toString() or object work. I actually have to refactor from get_ItemU to:

    Microsoft.Office.Interop.Visio.Master childPosition = doc.Masters.get_ItemFromID(Int32.Parse(child.Id))

    Even this doesn't work well with the majority of my shapes coming out OK but others are plain boxes without the executive belt "shape format" not applied.

    So generally speaking I *THINK* this is all just symptoms of needing to change / update to Visio 2013 sdk.

    Please if any of this is not clear or you would like to see more code just let me know and I will gladly update.

    Thank You

    Monday, December 23, 2013 4:30 PM

All replies