• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

Translate XML to MS Word format (.doc)

Hi, all.

Is there any way to transalate a XML document to a MS Word document format (.doc)?

Is there any translation method similar to create PDFs using xsl:FO?

My XML documents contains a tag set which represents bold, italics... and I need to create a .doc with a similar format.

TIA

Carlos
0
carlos0007
Asked:
carlos0007
2 Solutions
 
b1xml2Commented:
The first issue as always is what version of Word, is it Word 2000, Word 6, Word 97, Word 2002.

Points to note
==============
1. Word 2002 has superior xml support than Word 2000
2. Word 2000 can load HTML documents and save the document as a Word Document (using VBA)

Further points to note
======================
1. XML Documents are not for display purposes. They hold data that have relationships, so technically, there is really no possibility of translating XML documents to Word simply because it is not the way to do it. Presentation rules should not exist
0
 
BigRatCommented:
I must disagree with b1xml2. An XML document can be considered as a poor relation to an SGML document. The latter of course often gets translated to text based file formats; for techincal manuals and so on. So I disagree that "there is really no possibility of translating XML documents to Word".

I know of no tool which translates to Word, but I would suggest that you get yourself a RichTextFormat manual and have a look at that. You could start at RatFink (http://www.flightlab.com/cost/ratfink/ratfink.html) which is actually a Tcl library for RTF but at least it would be a start.

You find it rather difficult to go directly from XML to RTF and it might be worthwhile looking at an XSL:FO to RTF transform as something easier.
0
 
b1xml2Commented:
BigRat, I must disagree with you. Using XSLT can transform XML to some extent to HTML Format that Word can load and save as a *.doc. However, he is suggesting converting XML straight to Word.

What I have said is in regard to:
>>My XML documents contains a tag set which represents bold, italics... and I need to create a .doc with
a similar format.
<< and take it that he wants to convert XML straight to Word and that is where the context is.

>>
I know of no tool which translates to Word, but I would suggest that you get yourself a RichTextFormat
manual and have a look at that. You could start at RatFink (http://www.flightlab.com/cost/ratfink/ratfink.html) which is actually a Tcl library for RTF
but at least it would be a start.
<<

ensures what I have said:
"there is really no possibility of translating XML documents to Word" is true.

You are not saying anything new.

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
b1xml2Commented:
RTF is not .doc.
0
 
janegilCommented:
Staroffice 6 beta can, in a very messy sort of way.

But you'd have to write one or more XSLTs to convert your XML format to StarOffice's, zip several XML files together, rename the zip file, open it in AtarOffice and save as Word file.

So no, that's too messy. Maybe if StarOffice cleans up their act: saves a document in ONE xml file, and makes zipping an option.
0
 
carlos0007Author Commented:
I will try to focus on the main question:

I know tools to translate from XML to PDF: Translate XML to FO and after FO to PDF. OK?

I ask you: exists any similar tool to translate a XML document to .doc format?

We are a developer team: we want make an application for the clients to obtain the text in Word format.
We have a Oracle database with texts in XML and we give actually these texts in HTML format to the users, using XSLT.

Could we present this XML texts also in Word (.doc) format?

Carlos
0
 
robbertCommented:
There are no Word renderers (other than Word), like there are PDF renderers, from XSL:FO.
Also, I didn't found external applications (like a Word plugin) to import XML to Word - at least, nothing comfortable or serious.

- You would create placeholder fields in Word templates, loop through them, and replace their name/value by the XML node/attribute value which you identify by the Word fields names/values (the placeholder fields may also contain XPath statements or other commands which you would interprete).

http://www.braem17.yucom.be/xml2word.htm

Note: In the above link, the author states his technique was out-of-date. This is true for how he is implementing details, but his overall idea is still the only way to get this to work.
We've been through this, and our solution was quite similar.
0
 
BigRatCommented:
robberts link is very interesting. May I ask, Carlos, where the XML to "Word" rendering is to take place?

The XML to HTML rendering can take place on the server, to be delivered to the browser, or actually in the browser. In the case of .doc where should this take place?
0
 
sparkplugCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[Split points between BigRat and robbert.]
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

>S'Plug<
EE Cleanup Volunteer
0
 
Sparky191Commented:
Carlos - Was wondering what solution did you end up with.

I'm looking at XML>(XSL-FO)>RTF from VB.NET/ASP.NET
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now