Solved

How to generate simple xml code to import into visio

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Meetings to discuss business process can waste time, and often do .  The meeting's dialog can get confusing when participants have different professional perspectives and backgrounds.  A jointly-developed process picture helps wade through the confu…
This is about my first experience with programming Arduino.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

932 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

14 Experts available now in Live!

Get 1:1 Help Now