- Convert RTF to HTML format in C# and VB.Net
- Saved searches
- Use saved searches to filter your results more quickly
- SautinSoft/SautinSoft.RtfToHtml.Examples
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- Readme.md
- About
- How to Convert Rtf to HTML in C#.NET Code
- How to Convert Rtf to Html in C# language
- RTF to HTML .Net
- Overview
- Why choose SautinSoft.RtfToHtml?
- Fixed and Flowing
- Feature Highlights
Convert RTF to HTML format in C# and VB.Net
Document .Net can help your application to convert a document from a one format to another.
You’ll need only to Load() a document and Save() to a desired format.
DocumentCore dc = DocumentCore.Load(". "); dc.Save(". ");
Document .Net supports these formats:
using System.IO; using SautinSoft.Document; namespace Example < class Program < static void Main(string[] args) < ConvertFromFile(); ConvertFromStream(); >/// /// Convert RTF to HTML (file to file). /// /// /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/convert-rtf-to-html-in-csharp-vb.php /// static void ConvertFromFile() < string inpFile = @"..\..\..\example.rtf"; string outFile = @"Result.html"; DocumentCore dc = DocumentCore.Load(inpFile); dc.Save(outFile); // Open the result for demonstration purposes. System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) < UseShellExecute = true >); > /// /// Convert RTF to HTML (using Stream). /// /// /// Details: https://sautinsoft.com/products/document/help/net/developer-guide/convert-rtf-to-html-in-csharp-vb.php /// static void ConvertFromStream() < // We need files only for demonstration purposes. // The conversion process will be done completely in memory. string inpFile = @"..\..\..\example.rtf"; string outFile = @"ResultStream.html"; byte[] inpData = File.ReadAllBytes(inpFile); byte[] outData = null; using (MemoryStream msInp = new MemoryStream(inpData)) < // Load a document. DocumentCore dc = DocumentCore.Load(msInp, new RtfLoadOptions()); // Save the document to HTML format. using (MemoryStream outMs = new MemoryStream()) < dc.Save(outMs, new HtmlFixedSaveOptions() ); outData = outMs.ToArray(); >// Show the result for demonstration purposes. if (outData != null) < File.WriteAllBytes(outFile, outData); System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) < UseShellExecute = true >); > > > > >
Imports System.IO Imports SautinSoft.Document Namespace Example Friend Class Program Shared Sub Main(ByVal args() As String) ConvertFromFile() ConvertFromStream() End Sub ''' ''' Convert RTF to HTML (file to file). ''' ''' ''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/convert-rtf-to-html-in-csharp-vb.php ''' Private Shared Sub ConvertFromFile() Dim inpFile As String = "..\..\..\example.rtf" Dim outFile As String = "Result.html" Dim dc As DocumentCore = DocumentCore.Load(inpFile) dc.Save(outFile) ' Open the result for demonstration purposes. System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With ) End Sub ''' ''' Convert RTF to HTML (using Stream). ''' ''' ''' Details: https://sautinsoft.com/products/document/help/net/developer-guide/convert-rtf-to-html-in-csharp-vb.php ''' Private Shared Sub ConvertFromStream() ' We need files only for demonstration purposes. ' The conversion process will be done completely in memory. Dim inpFile As String = "..\..\..\example.rtf" Dim outFile As String = "ResultStream.html" Dim inpData() As Byte = File.ReadAllBytes(inpFile) Dim outData() As Byte = Nothing Using msInp As New MemoryStream(inpData) ' Load a document. Dim dc As DocumentCore = DocumentCore.Load(msInp, New RtfLoadOptions()) ' Save the document to HTML format. Using outMs As New MemoryStream() dc.Save(outMs, New HtmlFixedSaveOptions()) outData = outMs.ToArray() End Using ' Show the result for demonstration purposes. If outData IsNot Nothing Then File.WriteAllBytes(outFile, outData) System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With ) End If End Using End Sub End Class End Namespace
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:
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
RTF to HTML .Net is a standalone C# assembly to convert Text, DOCX, RTF documents into HTML/XHTML documents with CSS.
SautinSoft/SautinSoft.RtfToHtml.Examples
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
Readme.md
.NET SDK to convert RTF, DOCX to HTML
SautinSoft.RtfToHtml is .NET assembly to convert Text, RTF, DOCX to HTML. Provides your by API to transform Word documents to HTML5, 4.01, 3.2, XHTML with a lot of converting options.
- .NET Framework 4.6.1 — 4.8.1
- .NET Core 2.0 — 3.1, .NET 5, 6, 7, 8
- .NET Standard 2.0
- Windows, Linux, macOS, Android, iOS.
Getting Started with RTF to HTML .Net
Are you ready to give RTF to HTML .NET a try? Simply execute Install-Package sautinsoft.rtftohtml from Package Manager Console in Visual Studio to fetch the NuGet package. If you already have RTF to HTML .NET and want to upgrade the version, please execute Update-Package sautinsoft.rtftohtml to get the latest version.
string inpFile = @"..\..\..\..\example.rtf"; string outfile = Path.GetFullPath("Result.html"); RtfToHtml r = new RtfToHtml(); r.Convert(inpFile, outfile, new HtmlFixedSaveOptions() Title = "SautinSoft Example." >);
string inpFile = @"..\..\..\..\example.docx"; string outfile = Path.GetFullPath("Result.html"); RtfToHtml r = new RtfToHtml(); r.Convert(inpFile, outfile, new HtmlFixedSaveOptions() Title = "SautinSoft Example." >);
string inpFile = @"..\..\..\..\example.txt"; string outfile = Path.GetFullPath("Result.html"); RtfToHtml r = new RtfToHtml(); r.Convert(inpFile, outfile, new HtmlFixedSaveOptions() Title = "SautinSoft Example." >);
- Website:www.sautinsoft.com
- Product Home:RTF to HTML .Net
- Download SautinSoft.RtfToHtml
- Developer Guide
- API Reference
- Support Team
- License
About
RTF to HTML .Net is a standalone C# assembly to convert Text, DOCX, RTF documents into HTML/XHTML documents with CSS.
How to Convert Rtf to HTML in C#.NET Code
iDiTect .NET Converter allows developers to use C#/VB.NET to convert RTF to Html in Winforms and ASP.NET web application. Generate Html 4 and Html 5 from RTF document, with specific text font style and color, paragraph and page struct/layout, images and hyperlinks, full unicode and special characters support.
- «HtmlImageMode» — describes images export mode, contains Embedded, External.
- «ImagesFolder» — the folder that will contain the external image files.
- «ImagesSourceBaseFolder» — the base folder that will be set as value to the ‘src’ attribute of the ‘img’ elements.
- «HtmlStyleMode» — describes the export mode for the styles, contains External, Embedded, Inline and None.
- «StyleFile» — the file that will contain the external styles.
- «StyleSourceFile» — the file that will be set as ‘href’ attribute of the ‘link’ element pointing to the external styles.
How to Convert Rtf to Html in C# language
iDiTect offers an easy solution to convert RTF to HTML markup. Copy and paste the simple C# code into your .NET project.
RtfToHtmlConverter converter = new RtfToHtmlConverter(); //Load rtf from file string content = File.ReadAllText(«sample.rtf»); converter.Load(content); //Images are embedded in the main html file as Base64-encoded strings. converter.HtmlImageMode = HtmlImageMode.Embedded; //Styles are embedded in ‘style’ element in the ‘head’ section. converter.HtmlStyleMode = HtmlStyleMode.Embedded; //Convert rtf to html, and save it to file stream using (var stream = File.OpenWrite(«convert.html»))
What iDiTect .NET Document component can do
We provide powerful & profession document & image controls: ASP.NET import to Excel — C# and VB samples In many time you will find yourself with some data in SQL Server need to be saved or Export to Excel file. Load Excel Sheet Values in C#.Net creating an Excel spreadsheet in C#, and how we load the data into the worksheet. Web/HTML to PDF API for .NET HTML to PDF Converter for .NET and C# is a fast method to easily create richly-formatted PDF documents, images from HTML. C#: How can I convert an RTF file to a pdf file RTF is abbreviated from Rich Text Format and it is widely used by developers. How to: Programmatically create Word Create and write Word file (DOCX) in C# and VB.NET with iDiTect.Word component. Protect and Lock to Excel in C#.NET want to lock some of excel cells (not all) using C#. Protecting sheet after locking cells or range makes all cells read-only.
RTF to HTML .Net
.NET assembly to convert Text, RTF, DOCX to HTML. Provides your by API to transform Word documents to HTML5, 4.01, 3.2, XHTML with a lot of converting options.
- DOCX to HTML
- RTF to HTML
- Text to HTML
- Compatible on multiple platforms, such as Windows, macOS, and Linux
- Deploy to Azure and AWS
Latest Release Info
Overview
«RTF to HTML .Net» is 100% written in C# .NET assembly which provides a wide set of API for developers. It gives you ability to add these functions:
The SDK provides you by various methods and properties, to adjust the resulted HTML:
- Generates HTML in two different modes: Fixed and Flowing
- Set HTML version: XHTML 1.01, HTML5, HTML 4.01, HTML 3.2
- Set meta tags: Title, Description, Keywords
- Control how to store Images: embed or link, specify image format, directory and template name
- Produce HTML document only between . tags
- In HTML-Fixed mode you can convert only custom Page range
- Control how to Export CSS: inline or in external file
- Set single font family, color and size for complete HTML
- Generate Navigation page (like a TOC — table of contents)
Why choose SautinSoft.RtfToHtml?
Save memory and time with the lightweight API architecture. The bigger the document, the faster our API generates complex Word documents.
Convert Word documents to HTML
Gives API to your Apps to convert Text, RTF and DOCX documents to HTML: HTML5, HTML 4.01, 3.2 and XHTML.
Fixed and Flowing HTML modes
Generates HTML documents in two modes. Fixed HTML — in this mode the HTML document compound using (x,y) positions and special CSS for each elements. Flowing HTML — in this mode the HTML document compound using block elements the same as it would be typed by a human.
Full .NET Support for Windows, Linux, and Mac
Develop for any .NET platform or major operating systems with a single code base. Use in your apps for .NET Framework, Mono, Xamarin.iOS, and Xamarin.Android.
Useful conversion settings
Because of a lot useful settings and options, you may set up the conversion result as you wish: HTML version, set document title, page margins and border, image quality and format, headers and footers, various CSS options and a lot of more.
Deploy Apps With Word Docs to the Cloud
Be everywhere with cloud-based deployment. With NuGet and Documents for Word, you can deploy to Azure, AWS, and AWS Lambda.
Fixed and Flowing
Fixed HTML — in this mode the HTML document compound using (x,y) positions and special CSS for each elements. This gives the best precision and accuracy, but makes the HTML markup more complex. The each document page presented by the separated element with optional border.
Flowing HTML — in this mode the HTML document compound using block elements the same as it would be typed by a human. The HTML-markup is simple and clear, but it doesn’t preserve (x, y) position of some graphics elements.
Feature Highlights
Convert DOCX, RTF to HTML (Fixed and Flowing modes)
The component can produce HTML documents in two different modes: Fixed and Flowing. This sample shows difference between Fixed-HTML and Flowing-HTML.
Convert RTF to HTML using MemoryStream
Here is an example how to convert RTF document to HTML document in memory and get result as C# Stream object. Our SDK is completely standalone .NET assembly and doesn’t need anything else.
Convert DOCX file to HTML file
RTF to HTML .Net gives your app API to convert DOCX documents to HTML pages. It has own HTML writer which supports CSS and own standalone DOCX reader.