Solved

How to generate simple xml code to import into visio

Posted on 2010-08-24
4
1,304 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
  • 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 30

Accepted Solution

by:
Scott Helmers earned 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now