Hi
I have a Visio 2013 diagram with networking objects.
Each object has a text value.
How do I go to each object and retrieve its text value?
I prefer using C# but any language i.e. VB/VBA is fine.
T
Technology Tips and News
Hi
I have a Visio 2013 diagram with networking objects.
Each object has a text value.
How do I go to each object and retrieve its text value?
I prefer using C# but any language i.e. VB/VBA is fine.
T
The easiest way is a simple vba macro that walks the pages and the shapes on the pages.
there are several examples of this over on Chris Roth's site. www.visguy.com
al
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
You can use the following c# code for this. Use the visio.
Please let me know if this solved your issue
Application visApp = new Visio.Application(); visApp.Visible = true; Document document = visApp.Documents.Open(@"C:\xyz.vsdx"); foreach (Page page in document.Pages) { foreach (Shape shape in page.Shapes) Console.WriteLine(shape.Text); }
Hi
Do I use :
using Microsoft.Office.Interop.Visio;
If so, which reference do I use?
Thanks.
- Andre
When you use the Visual Studio and start a office/sharepoint project for Visio 2013 the correct references are added automatically.
Hi
How do I go about setting this up for execution?
- Andre
Still haven't gotten anywhere with this.
The MSDN site only has how to open a document which I can easily do.
Enumeration is a different matter.
There's loads of info on how to do this on the VisioGuy site, and in the Visio SDK, and on MSDN, and you've been given C# code to do your getting text.
P.S. You need to iterate all the shapes, not enumerate.
Hi Paul
Thanks so much!
Clarifying that I need to Iterate instead of enumerate helped.
I then found this gem:
https://msdn.microsoft.com/en-us/library/office/ff767988.aspx?f=255&MSPPError=-2147217396
This is what I needed to get the app going.
Swetha, thanks for the C# code but I am not sure where to put this in the Visio since I only see VBA based Macros in the Visio document :-(
Swetha
Thanks for the C# code but I am not sure where to put this in the Visio since I only see VBA based Macros in the document :-(
You don't put C# code in Visio, you use C# to build an addon for Visio with Visual Studio. I think for what you want you need to use VBA, i.e. a macro.
P.S. you will not make any friends here by unmarking all the answers you've been given and then marking your own comment as the answer (when it's not).
Hi Paul
Thanks...and so sorry to you and the team.
- Andre