Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to convert html file to doc or rtf format

How to convert html file to doc or rtf format

Scheduled Pinned Locked Moved C#
xmltutorialcsharphtml
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Inam
    wrote on last edited by
    #1

    I want to convert html file to Doc or rtf file. How it will be possible using c# through coding. Actually i have xml file and xsl file too. So if there is a way through which we can create a doc or rtf file if we provide xml and xsl file path or html file path than guide me to that. Thanx in advance Inam

    H 1 Reply Last reply
    0
    • I Inam

      I want to convert html file to Doc or rtf file. How it will be possible using c# through coding. Actually i have xml file and xsl file too. So if there is a way through which we can create a doc or rtf file if we provide xml and xsl file path or html file path than guide me to that. Thanx in advance Inam

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      There's many ways to do this. Since RTF, for example, is just simple text, you could write your XSLT to output the necessary lines (actually, XSLT can also output binary files, but this gets much more difficult). You can find the RTF specifications on Microsoft's site, as well as other places if you try googling. To create Word docs, you could do a number of things. You could use the Office PIAs (primary interop assemblies, which is recommended as opposed to making your own interop assemblies) to load the HTML document into word and then save it back out as a Word Document or an RTF document, all without showing the Word UI (it's still started, but not visible until you call Show on the application). Also, Word 2000, XP, and 2003 all support XHTML - an XML document with the default namespace resembling HTML. You could always generate this instead of HTML (which doesn't necessarily conform to XML standards - nor does it have to in some cases). Word 2003 also has a well-defined schema for Word Documents that is also published on MSDN[^]. Finally, in referene to this and your previous question, there's products out there that can save reports (if you're doing any sort of reporting) to many common formats, such as HTML, PDF, and RTF. Crystal Reports for VS.NET comes with VS.NET and is installed by default. The runtime and your report definitions can be distributed freely so long as you have a valid license for VS.NET, have registered Crystal Reports for VS.NET, and are shipping as part of a Windows Forms application (ASP.NET application have additional restrictions and typically require additional runtime licenses). A cheaper alternative is ActiveReports from Data Dynamics[^].

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups