Re: Import XML into Word Document

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi =?Utf-8?B?THVuZEs=?=,

today I read an Article on MSDN on how to create Word templates that use XML
schemas. The Articel is called "Creating and Applying an XML Resume Template
in Microsoft Office Word 2003"

(http://msdn.microsoft.com/office/understanding/xmloffice/codesamples/default.asp
x?pull=/library/en-us/odc_wd2003_ta/html/odc_wdxmlresumetemp.asp)
The features described are very nice, at least the option to export the data
as XML. Now I am searching for a way to import this data into my template. Is
there a way to do this? I understand that the saved XML can be used in other
applications but I would like to use Word to show XML data from my .NET
application. This would be a very nice way for reports or maybe mailmerges.

You have, in Word 2003 without VSTO 2005, basically three possibilities:

1. Use a transform when opening the document that "merges" data into the Word XML
document.

2. Use the basic XML tools the .NET Framework offers to parse the (closed) Word
XML and add the data, then open the result

3. Automate the Word object model, using the InsertXML method to place the data
(in valid WordProcessingML format) into the opened document.

Current versions of Word provide for no "mail merge"-type ability to import XML
data. You might want to take a look at VSTO 2005 and see if the "data islands"
are closer to what you're looking for. Word 2007 will also have some new features
that will probably interest you, so when you can, sign up for Beta 2.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

.



Relevant Pages

  • Re: MSSQLError overwriting returning XML
    ... results of the template to strip out the errors. ... > MSSQLError processing instructions but to also return a XML that I'm ... > some tables and the stored procedure will always return some other data ... > generates a new value for AuthNo and adds it into the table again. ...
    (microsoft.public.sqlserver.xml)
  • Re: tab and return in mail merge
    ... I don't know about Content Control facilities and I don't see where the .net ... My "template" is saved in Word XML format. ... I am wondering what you mean by a "template" in CRM. ...
    (microsoft.public.word.vba.general)
  • Re: Data entry environment using Word 2003
    ... I suggest using a template centered around the use of Styles, Tables, ... add if VBA can be used Document Variables. ... deletion since style before and after for every element in your document is ... you mean that you wish to use xml schemas and stylesheets then ...
    (microsoft.public.office.developer.web.components)
  • Re: How to serialize Mfc template dialog class ?
    ... I do not believe you can derive a template class from CObject, ... MFC serialization is among the worst possible ways to implement persistent ... tend to use either simple text files or XML files if I have complex structured data. ... ignored the binary form of the file and read the XML form [yes, ...
    (microsoft.public.vc.mfc)
  • Re: Data entry environment using Word 2003
    ... I suggest using a template centered around the use of Styles, Tables, ... add if VBA can be used Document Variables. ... deletion since style before and after for every element in your document is ... you mean that you wish to use xml schemas and stylesheets then ...
    (microsoft.public.office.developer.vba)