Generating XSLT from Word 2007 document?  
Author Message
Kris4forums





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi,

After attaching an XML schema to word 2007 document, I would like
to generate an XSLT file from it. In Word 2003, I can do it by
running WML2XSLT.exe tool on doc.xml file. As .docx is a container
with many parts in it, Is there a way in word 2007 to do the same

TIA,
Kris


Visual Studio Tools for Office36  
 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

As Word 2007 is still in beta (not even RTM), not yet. (No idea if one is in planning, either)

 
 
Kris4forums





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Cindy,

Does that mean one has to live with own predefined xslt templates with limited formatting capabilities. Or Else If I have a XML schema attached dotx template and I want to apply the
DataOnly.xml to it, then do I have to parse through the document parts and edit the values
on my own. You have answered me in the below thread for a little different requirement.

http://forums.microsoft.com/msdn/ShowPost.aspx postid=442286&siteid=1


Thanks,
Kris

 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

I'm afraid I'm not sure I understand your follow-up question. Can you expand a bit more on what you're envisioning

You can continue to use any XSLT you have now (because Word 2007 should be able to open a Word 2003 XML doc).

You can develop an XSLT that generates any Part of a Word 2007 file. Then you'd need to assemble the file from its Parts (into a ZIP) file.

Or you can take an existing Word 2007 file (zipped), programmatically access a Part and process it using XML tools.

When we put VSTO and ContentControls into the mix, that gives you more possibilities.

It won't be possible to generate an entire Word 2007 file using just an XSLT because it's a composite of many, separate xml files.



 
 
Kris4forums





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Cindy,

Thanks for the info.
I want to merge different data xml files with a document template(attached with an xsd) like in a mail merge and generate multiple documents. I want to do it without writing much code. Below is an article from Brian Jones which is exactly I was looking for.

http://blogs.msdn.com/brian_jones/archive/2006/01/09/CustomXML1.aspx


Regards,
Kris

 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Kris

Does this article cover what you have in mind

http://msdn2.microsoft.com/en-us/ms406053.aspx



 
 
Kris4forums





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Cindy,

Thank you. I looked in to it before and it's defintely part of what I am looking for. I also wanted to know how to map xml data to content controls manually. Here I found a link from modonovan which is unfortunately lot of work outside Word Application.

http://blogs.msdn.com/modonovan/archive/2006/05/23/604704.aspx

There he says there is no UI support to map the contentcontrols to xml manually.

Do you know any other way to do this.

 

TIA,

Kris

 

 

 


 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Kris

He is correct, MS has provided no interface for doing this manually and I've never heard anyone say they have any intention of doing so.

Why would you be asking in a "dev" forum about mapping the controls manually :-) (I can imagine a number of reasons, but I'm curious as to yours.)



 
 
Kris4forums





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Cindy,

So that my power users can continue preparing document templates without my help. Otherwise we have to give lot of support in doing so.

Honestly I couldn't find any other place where I could get a prompt answer by you or other experts on this subject. Any way could you please let me know the more relevant forums for word 2007 vis-a-vis C# .NET 3.0 framework development.

cheers,

Kris


 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Kris

Well, since 2007 is still in beta and the team is heads-down working on it, you're probably not going to find many information sources at the moment. Once 2007 gets to the RTM stage (no idea when that will be, but best guess would be sometime this fall) the Office team will 1. know exactly how things work and 2. have more time to provide answers. And only from this point on can the .NET folks really get down to business.

Concerning your users setting up templates: I can envision a couple of possible scenarios.

1. If they're fairly competent, let them insert the ContentControls and type information concerning what data should be mapped into the Title, or into the control. You can then open these documents in a separate process to do the actual mapping.

2. Provide more support by giving the users a way to select a "data source" that will give them a list of fields. They indicate where in the document a field should go, and your code takes care of inserting the ContentControl and mapping it. This could be done with a VSTO solution or with an Addin.



 
 
Kris4forums





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hello Cindy,

Thanks a lot for the suggestions. If I understood correctly, it seems the 2nd way may guide/restrict the user what data is available for that template used in a certain process. Could you please explain a bit more on the 2nd way and some links/samples to it.

TIA,

Kris


 
 
Cindy Meister





PostPosted: Visual Studio Tools for Office, Generating XSLT from Word 2007 document? Top

Hi Kris

Well, I can't give you any links or samples. Most solutions I've done have been proprietary and anyway not with Office 2007 (as I said, it's too early for that kind of thing - if you beta test that means you work out the code base before there are any samples around!) But I can go into a bit more detail on possible approaches.

1. In any case, you present the user with a selection of data sources. These could be tables in a database, but would more likely be views or stored procs that aggregate tables and pre-filter the data. Say, for example, a list in a Windows Form, or a drop down list on a CommandBar or an Actions pane.

2. The user chooses the data source for which he wants to create a "template". (Insert target controls)

3. This populates a second list with the available field names from the selected data source AND adds the necessary XML into the custom.xml document Part. Selecting a field name inserts the "target" (a ContentControl) into the document and maps it to the matching XML in custom.xml

Have you seen this article

http://msdn2.microsoft.com/en-us/library/ms406053.aspx