Dynamically generate a MS Word document using ASP.Net
-
How we can Dynamically generate a MS Word document using ASP.Net????? Jijo kuruvila software developer trivandrum
-
How we can Dynamically generate a MS Word document using ASP.Net????? Jijo kuruvila software developer trivandrum
If all you need to support was Word 2003, you can use the published Word 2003 XML Schema that you can download (as well as documentation) at http://www.microsoft.com/downloads/details.aspx?familyid=fe118952-3547-420a-a412-00a2662442d9&displaylang=en[^]. Generate XML through a variety of means (using the DOM with the
System.Xml
classes or using an XSLT using theSystem.Xml.Xsl
classes) and - if you display the generated content in Internet Explorer and have Word 2003 installed - it should open up in Word. If you need to support downl-level versions, I suggest you use XHTML (XML with a default namespace to mimic HTML for older browsers) with the following processor instruction at the top:<?xml version="1.0">
<?mso-application progid="Word.Document"?>This would be supported by Word 2000 and newer. If you want to support older clients yet and generate binary content, then you'll have to use automation (generating an RCW (runtime callable wrapper) from the Word typelib usign VS.NET->Add Reference->COM or tlbimp.exe), which isn't safe in a multi-threaded server application like ASP.NET. You'd be responsible for thread safety. If you must use that route, be sure to create an RCW (an "interop assembly") from the oldest typelib you want to support. Since Office components (and all COM servers should be written this way, though that's not always the case) are backwards compatible, they support older interfaces. You could even generate an RCW from a new typelib, but you must be sure not to use interfaces that are new to a version you might want to support. Because this would be on a server you would most likely control, however, you should get some control over what version is installed. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]
-
If all you need to support was Word 2003, you can use the published Word 2003 XML Schema that you can download (as well as documentation) at http://www.microsoft.com/downloads/details.aspx?familyid=fe118952-3547-420a-a412-00a2662442d9&displaylang=en[^]. Generate XML through a variety of means (using the DOM with the
System.Xml
classes or using an XSLT using theSystem.Xml.Xsl
classes) and - if you display the generated content in Internet Explorer and have Word 2003 installed - it should open up in Word. If you need to support downl-level versions, I suggest you use XHTML (XML with a default namespace to mimic HTML for older browsers) with the following processor instruction at the top:<?xml version="1.0">
<?mso-application progid="Word.Document"?>This would be supported by Word 2000 and newer. If you want to support older clients yet and generate binary content, then you'll have to use automation (generating an RCW (runtime callable wrapper) from the Word typelib usign VS.NET->Add Reference->COM or tlbimp.exe), which isn't safe in a multi-threaded server application like ASP.NET. You'd be responsible for thread safety. If you must use that route, be sure to create an RCW (an "interop assembly") from the oldest typelib you want to support. Since Office components (and all COM servers should be written this way, though that's not always the case) are backwards compatible, they support older interfaces. You could even generate an RCW from a new typelib, but you must be sure not to use interfaces that are new to a version you might want to support. Because this would be on a server you would most likely control, however, you should get some control over what version is installed. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]
Thanx a lot....:) Jijo kuruvila software developer trivandrum