|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All
I have an XML file which gets transformed into HTML via an XSL stylesheet. The HTML file is in a tabular format. this is all good. What I want to do is perform a similar transformation of the xml file but have it directly output to MS word - any ideas on the best way to do this? tia |
|
#2
|
||||
|
||||
|
I do now how to transform XML into Word format because a Word document has a proprietary format.
What about opening the html file in Word and save it as doc? |
|
#3
|
|||
|
|||
|
what i'm using is the VB DOM to open and transform the xml file (using XSL) , the result is saved in an HTML format. I then use VB word application objects to open the html file in a word session, however when i do this all i get is the HTML source not the 'pretty' stuff.
The reason I need to be able to open the formatted html in word is so i can muck around with page breaks for printing purposes. if i open the html file in an internet explorer session it all looks great not sure what I'm doing wrong.... |
|
#4
|
||||
|
||||
|
Hey - I have been trying to figure out how to save my HTML to a file with .html extension and not just render it to the browser upon request. My XSl is transforming the entire site properly but I have not found a way to "save a copy" of the resulting html that is rendered. Do you mind showing me what you are talking about in the VB Dom transformation?
|
|
#5
|
|||
|
|||
|
Well, if you have some time and feel like learning java, you can use Cocoon: http://cocoon.apache.org/2.0/ to do the conversion. It has an output stream for Word (and I think Excel) documents.
|
|
#6
|
|||
|
|||
|
thanks for that - looks like I now have a choice of the lesser of a few evils as I did manage to find an offical Word Markup Language reference (attached) - on a quick glance it looks fairly extensive and Java still might be the go.
I also came a cross a number of sites which also might be of interest to anyone else going along the XML -> word route http://www.xmlsoftware.com - has lots of XML related conversion tools XML2RTF, DB2XML, OniMark, ASP2XML etc http://www.scriptura-xsl.com/index.html - these guys have a product which uses XSL-FO to produce reports in multiple formats - means learning XSL-FO and WordML tho ![]() |
|
#7
|
|||
|
|||
|
It's quite easy...
//Saving the File...
fso = new ActiveXObject ("Scripting.FileSystemObject"); strFilePath = "C:\\Document.html" ts = fso.CreateTextFile (strFilePath, true, true); ts.Write(tmp); ts.Close(); //Opening it in Word... word = new ActiveXObject("word.application"); word.Visible = true; word.Documents.Open("C:\\Document.html"); |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML to Word transformation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|