Key Features
HTML to Text
Merge RTF
Download trial
What's New
Tutorials & Videos
How to convert multiple HTML files to a single RTF using C# .Net platform.

"How to convert HTML to DOCX in C#?"

How to convert HTML to DOCX in C#?


    Imagine, that in 15 minutes after reading this text you will be able to provide API for your application to convert HTML page into DOCX documents, using C# or VB.Net.
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            string htmlString = @"Hello World!";
			byte[] docxBytes = h.ToDocx();
To get the ability of HTML conversion in you .Net application:
  • Download the latest «HTML to RTF .Net» SDK.
  • Follow to the "Solution Explorer" tab and add a reference to the "SautinSoft.HtmlToRtf.dll".
Not too shabby! Now you can operate with HtmlToRtf class which provides you by various methods and properties to convert HTML as MemoryStream, String, Files, URI and so forth:
How looks HtmlToRtf .Net class

Nuget   Online Demo   Download, (Jun 4th, 2018)

Have a Question?

You have a question, need a support or a code example: ask our support team at We will help you quickly and with pleasure.

At the final point of this page we've prepared five various examples to convert HTML to RTF.

Five examples to convert HTML to RTF in C# and VB.Net

1. Simple conversion of HTML file to RTF file in C#:

            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            string htmlFile = @"d:\Resurrection.html";
            string rtfFile = Path.ChangeExtension(htmlFile, ".rtf");

            h.ConvertFile(htmlFile, rtfFile);
2. Convert HTML to RTF in memory using C#; Set page size to Letter/Landscape, add page numbers:
            SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();

            string htmlFile = @"d:\Resurrection.html";
            string htmlString = File.ReadAllText(htmlFile);

            // Let's set some page options.

            h.PageStyle.PageNumbers.Format = "Page {page} of {numpages}";
            h.PageStyle.PageNumbers.AlignH = SautinSoft.HtmlToRtf.eAlign.Center;
            h.PageStyle.PageNumbers.AlignV = SautinSoft.HtmlToRtf.eAlign.Bottom;

            // Start the conversion.
            string rtfString = h.ConvertString(htmlString);
3. Convert HTML to RTF in memory using VB.Net; Set page size to Letter/Landscape, add page numbers:
			Dim h As New SautinSoft.HtmlToRtf()

			Dim htmlFile As String = "d:\Resurrection.html"
			Dim htmlString As String = File.ReadAllText(htmlFile)

			' Let's set some page options.

			h.PageStyle.PageNumbers.Format = "Page {page} of {numpages}"
			h.PageStyle.PageNumbers.AlignH = SautinSoft.HtmlToRtf.eAlign.Center
			h.PageStyle.PageNumbers.AlignV = SautinSoft.HtmlToRtf.eAlign.Bottom

			' Start the conversion.
			Dim rtfString As String = h.ConvertString(htmlString)
4. Convert HTML to RTF in C#; Add a custom page header from HTML, add footer from another RTF:
            SautinSoft.HtmlToRtf h = new HtmlToRtf();
            string htmlPath = @"d:\The Living.html";
            string rtfPath = Path.ChangeExtension(htmlPath, ".rtf");

            // Add a header from HTML string.
            h.PageStyle.PageHeader.Html("This is a bold italic line.");

            // Add a footer from RTF file.

            // Make the conversion of HTML to RTF.
            h.ConvertFile(htmlPath, rtfPath);
5. Convert HTML to RTF and extract all images from HTML (local, remote, even embedded within base-64) in C#:
            SautinSoft.HtmlToRtf h = new HtmlToRtf();
            string htmlPath = @"d:\Fathers and Sons.html";
            string htmlString = File.ReadAllText(htmlPath);
            string rtfPath = Path.ChangeExtension(htmlPath, ".rtf");

            List<HtmlToRtf.SautinImage> imgList = new List<HtmlToRtf.SautinImage>();

            h.BaseURL = @"d:\";

            // Convert HTML to and place all images inside imgList.
            h.ConvertString(htmlString, imgList);

            // Save all images to HDD.
            foreach (HtmlToRtf.SautinImage img in imgList)
                img.Img.Save(String.Format(@"d:\{0}.png", img.Cid));

If anyone needs a code sample in C#, VB.Net, ASP.Net etc "How to convert HTML to RTF", email us at or ask at Online Chat (right-bottom corner of this page). We'll help you certainly!

Requrements and Technical Information

     Requires only .Net 4.0 or higher. Our product is compatible with all .Net languages and supports all Operating Systems where .Net Framework and .Net Core can be used. Note that PDF Focus .Net is entirely written in managed C#, which makes it absolutely standalone and an independent library.

.Net Framework 4.0 and higher and .Net Core 2.0 and higher

.Net Framework 4.0, 4.5, 4.6.1 and higher.

.Net Core 2.0 and higher.

Reasonable prices

     The library offers developers high quality conversion at reasonably prices. The main point of interest is that «HTML to RTF .Net» is less expensive than all of its more or less popular counterparts. For example, a single license cost $339 with no additional fees or royalties!


To see this functionality firsthand, download the freshest «HTML to RTF .Net» with code examples, 19.3 Mb.

Products Downloads Support Company
Buy now
Follow us on Google Plus SautinSoft on Facebook SautinSoft on Twitter SautinSoft on Youtube Our Blog
Copyright © 2002 - 2018 SautinSoft (started from All rights reserved.