Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / July 2004

Tip: Looking for answers? Try searching our database.

load data into word table or tabular form automatically from XML

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 08 Jul 2004 07:49 GMT
I have some data in a very simple XML file,

I want a simple & easy way to load this into a Table in Word document.
(which will automatically add the required number of rows into this table).
Basically i want to be free of any code which has to do with adding rows &
setting the values.
I dont mind having a complex, but generic way of plugging this data into a
table in Work Document.

Is there such a way to achieve this (To populate data in a Table or at least
tabular form in a Word Document)???

Sample XML data.

<AdrBook>
   <row>
       <Name>Alex</Name>
       <age>14</age>
   </row>
   <row>
       <Name>Alex 2</Name>
       <age>24</age>
   </row>
   <row>
       <Name>Alex3</Name>
       <age>35</age>
   </row>
</AdrBook
Kathleen - 09 Jul 2004 14:21 GMT
If you can do a bit of programming, you can do this
relatively easily using Find & Replace (and a loop or
Case statement to do the repetitious processing). I have
simplified the details, but basically you need to follow
the steps below.  
1. Work out what your table headings should be from the
open tags, e.g. <Name> becomes Name and <Age> becomes
Age. Build up the first row of the table with tab
separators, eg.,
Name^tAge^p   (^t is a tab, ^p is a paragraph marker)
2. Change the tags in the middle into a tab marker so it
looks like this:
<AdrBook><row>
Name^tAge^p
      <Name>Alex^t14</age>
   </row>

You can do that by searching for </name>*<age> and
replacing it with nothing, but the syntax is more
complicated than that (you have to stick / or \
characters [I can't remember which offhand] in front of
the special characters). Open up the Help file and learn
about how to do Find & Replace with Wildcards. You'll
need to practice this.

3. Then, delete all the other tags except for the two
<AdrBook> tag until it looks like this:
<AdrBook>
Name^t^Age^p
Alex^t14^p
Alex 2^t24^p
</AdrBook>

4. Select everything within the <AdrBook> tags and
convert Table to text using tabs.

5. Format the table and delete the <AdrBook> tags.

>-----Original Message-----
>I have some data in a very simple XML file,
[quoted text clipped - 27 lines]
>
>.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.