Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Translate XML to MS Word format (.doc)

Posted on 2002-03-25
11
563 Views
Last Modified: 2013-11-19
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
Comment
Question by:carlos0007
11 Comments
 
LVL 23

Expert Comment

by:b1xml2
ID: 6895720
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
 
LVL 27

Expert Comment

by:BigRat
ID: 6896074
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
 
LVL 23

Expert Comment

by:b1xml2
ID: 6896083
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 23

Expert Comment

by:b1xml2
ID: 6896084
RTF is not .doc.
0
 
LVL 1

Expert Comment

by:janegil
ID: 6896447
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
 

Author Comment

by:carlos0007
ID: 6896717
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
 
LVL 15

Accepted Solution

by:
robbert earned 50 total points
ID: 6897975
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
 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 50 total points
ID: 6909174
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
 
LVL 9

Expert Comment

by:sparkplug
ID: 8730746
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
 
LVL 1

Expert Comment

by:Sparky191
ID: 13120524
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

789 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