?
Solved

How to generate simple xml code to import into visio

Posted on 2010-08-24
4
Medium Priority
?
1,491 Views
Last Modified: 2012-06-21
Hi Experts,

I want my VB-Application to generate xml-Code that later on can be opened in Visio 2003.
This as about orga charts, so in my xml code I need to generate the shapes that are necessary for an orga chart.
When I create an orga chart in Visio 2003 and export it to an vsx file, I get a very large file, even if I set the PreviewDocument property off.

What I need is a rather simple examle of an xml file that contains the most important properties like how to create the 3 or 4 different shapes for an ograchart and connections between them. An overview over the "syntax" for the most common features would be greate, too.

Thanks for your help!

Kai

0
Comment
Question by:Lupo09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Expert Comment

by:arch-itect
ID: 33512703
Here is the reference (wait for it to load completely) :

http://msdn.microsoft.com/en-us/library/Aa218408
http://msdn.microsoft.com/en-us/library/aa830812(v=office.10).aspx

Here are some MSXML utilities that might be helpful in generating xml from an xml schema

http://msdn.microsoft.com/en-gb/data/bb190600.aspx
0
 
LVL 31

Accepted Solution

by:
Scott Helmers earned 2000 total points
ID: 33520778
You're right that the amount of code produced by Visio's Save as XML is pretty absurd. In stark contrast to that code, it takes a surprisingly small amount of XML to actually create a Visio drawing, so your question is very appropriate.

Chris Roth (aka "The Visio Guy") made a presentation on this subject at the 2006 Visio Conference and though it was four years ago, the content is still very relevant. His slides and code samples are available at the second link.

One other thought -- unless you specifically need XML for some other reason, are you aware that your code can run the Org Chart wizard directly? This is especially useful if the data from which you want to create the org chart already exists in SQL or Excel or various other data sources. This article from Microsoft describes the command line parameters and if you'd like to see an example with sample code, I co-wrote an article about automating the creation of org charts, albeit for a somewhat unique purpose.

Regards,
Scott
 
0
 

Author Comment

by:Lupo09
ID: 33534329
Hi Folks,
the links provided by arch-itect helped gathering valuable information on how to deal with XML-and Visio, thanks!
Your approach, Scott, to built up an orga chart using the Excel Import Wizard within an VBA script is a really great idea! I do not really rely on XML, but I would prefer it, because I could have my Application create the XML-File regardless if Visio or Excel is installed.
I think, I will go for your solution and export my Orga Data to Excel, create a Visio Object within my App and use your example code to import the Orga Data using the Visio Wizard. Users who would use this function can be told to have Visio and Excel installed.

Nevertheless, If anybody has an example of an tiny little xml-file that can be opened in Visio as an Orga Chart, I would appreciate that very much. (I was experimenting for  hours and don't seem to come to a solution...)

Thanks a lot to all of you!

Kai
0
 

Author Closing Comment

by:Lupo09
ID: 33556083
Although my approach was another one, your solution is a very elegant way to come to the same result.

Thanks,

Kai
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question