How to convert multiple HTML files to a single RTF using C# .NET platform.
For example, there is an online book consisting of a set of HTML files. (As shown in the figure). We’ve a task to convert some html files from this book into single RTF document.

The solution:
Component HTML-to-RTF.Net not only can convert HTML files to RTF, but unite received RTF files into one.
Below is a sample code showing how to convert HTML documents and get a single RTF document:
SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
string[] htmlFiles = Directory.GetFiles(@"c:\htmls\", "*.htm*");
string singleRtfPath = @"c:\Book.rtf";
List rtfDocs = new List();
// Convert each HTML file from "c:\htmls\" into RTF document
foreach (string htmlFile in htmlFiles)
rtfDocs.Add(h.ConvertFileToString(htmlFile));
string singleRtfDoc = String.Empty;
foreach (string rtfDoc in rtfDocs)
singleRtfDoc = h.MergeRtfString(singleRtfDoc, rtfDoc);
File.WriteAllText(singleRtfPath, singleRtfDoc);
If you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: