HighTechTalks DotNet Forums  

convert HTML to Word doc

Dotnet XML microsoft.public.dotnet.xml


Discuss convert HTML to Word doc in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?Q2FzcGVy?=
 
Posts: n/a

Default convert HTML to Word doc - 07-09-2007 , 11:16 AM






I have this code that creates an HTML formatted document and I can open the
document through Word. But I want the format to be truely MS Word (2003).
Does anyone know how to do this?

Here's my code that does the first conversion:

xmlfile = "myfile.xml"
xsltfile = "myfile.xslt"

Dim xmlDoc As New XmlDocument()
xmlDoc.Load(Server.MapPath(xmlfile))

Dim xslTran As XslTransform = New XslTransform()
xslTran.Load(Server.MapPath(xsltfile))




Response.ContentType = "application/msword"
Response.ContentEncoding = System.Text.Encoding.Default
Response.Charset = ""
xslTran.Transform(xmlDoc, Nothing, Response.Output)


Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: convert HTML to Word doc - 07-09-2007 , 11:27 AM






Casper wrote:
Quote:
I have this code that creates an HTML formatted document and I can open the
document through Word. But I want the format to be truely MS Word (2003).
Does anyone know how to do this?
Word 2003 can handle a couple of formats like doc, rtf and WordML.
WordML is XML so it is possible to write an XSLT stylesheet that
transforms some XML to WordML. You could then run that transformation
the same way as before.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #3  
Old   
Martin Honnen
 
Posts: n/a

Default Re: convert HTML to Word doc - 07-09-2007 , 11:27 AM



Casper wrote:
Quote:
I have this code that creates an HTML formatted document and I can open the
document through Word. But I want the format to be truely MS Word (2003).
Does anyone know how to do this?
Word 2003 can handle a couple of formats like doc, rtf and WordML.
WordML is XML so it is possible to write an XSLT stylesheet that
transforms some XML to WordML. You could then run that transformation
the same way as before.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #4  
Old   
=?Utf-8?B?Q2FzcGVy?=
 
Posts: n/a

Default Re: convert HTML to Word doc - 07-09-2007 , 04:44 PM



Yes. I know. However, the problem I come across is an .css file that the
HTML references. So when the file is opened offline, the user would get an
error saying that is cannot find the .css file.

"Martin Honnen" wrote:

Quote:
Casper wrote:
I have this code that creates an HTML formatted document and I can open the
document through Word. But I want the format to be truely MS Word (2003).
Does anyone know how to do this?

Word 2003 can handle a couple of formats like doc, rtf and WordML.
WordML is XML so it is possible to write an XSLT stylesheet that
transforms some XML to WordML. You could then run that transformation
the same way as before.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
  #5  
Old   
=?Utf-8?B?Q2FzcGVy?=
 
Posts: n/a

Default Re: convert HTML to Word doc - 07-09-2007 , 04:44 PM



Yes. I know. However, the problem I come across is an .css file that the
HTML references. So when the file is opened offline, the user would get an
error saying that is cannot find the .css file.

"Martin Honnen" wrote:

Quote:
Casper wrote:
I have this code that creates an HTML formatted document and I can open the
document through Word. But I want the format to be truely MS Word (2003).
Does anyone know how to do this?

Word 2003 can handle a couple of formats like doc, rtf and WordML.
WordML is XML so it is possible to write an XSLT stylesheet that
transforms some XML to WordML. You could then run that transformation
the same way as before.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.