How to Convert Access Rich Text HTML to RTF for VB.NET RichTextBox
Question details
The user needs to display Microsoft Access rich text, which is stored natively as HTML, in a VB.NET RichTextBox that requires RTF format, typically after migrating the database to SQL Server.

- Product
- Microsoft Access, SQL Server, VB.NET
- Device & OS
- not provided
- Scenario
- Migrating an MS Access database with rich-text Long Text fields to SQL Server and attempting to display the migrated text in a VB.NET desktop application.
- Observed behavior
- The data appears as raw HTML tags (e.g., div, font, strong) in the SQL Server varchar(max) field, which the VB.NET RichTextBox cannot natively render without being converted to standard RTF.
Ensure you have a reliable backup of your SQL Server database before running batch conversions, and familiarize yourself with third-party .NET HTML-to-RTF library options.
Use a Dedicated HTML-to-RTF Conversion Library
The most robust method is to utilize a specialized .NET library that handles the complex mappings between HTML tags and RTF headers.
Access rich text is inherently stored as HTML. Directly porting it to a VB.NET RichTextBox requires translating HTML tags into RTF syntax, which involves defining fonts and color tables in the RTF header.
Avoid using the deprecated WebBrowser document.execCommand approach as it is unsupported and prone to rendering issues.
Choose a reputable third-party HTML-to-RTF library compatible with your VB.NET project framework (e.g., via NuGet Package Manager).
Pass the retrieved SQL Server varchar(max) HTML string into the library's conversion method to generate standard RTF.
Set the output string directly to the Rtf property of your VB.NET RichTextBox, rather than the Text property.

Develop a Custom HTML to RTF Parser
If you want to avoid third-party dependencies and your stored HTML is relatively simple, you can build a custom string manipulation or RegEx-based parser.
Switch to WPS Office for Seamless Document Management
While programmatic conversions between Access and VB.NET require technical coding solutions, your everyday office tasks shouldn't be complicated. WPS Office provides a free, lightweight, and user-friendly alternative to Microsoft Office, ensuring high compatibility with all your standard documents without the heavy resource usage.

Frequently Asked Questions
Why does Microsoft Access store rich text as HTML instead of RTF?
Microsoft Access uses HTML to format rich-text Long Text fields to ensure web compatibility and ease of integration with modern web-based applications, diverging from older RTF standards.
Can I use the VB.NET WebBrowser control to handle the HTML to RTF conversion?
It is highly discouraged to rely on the deprecated WebBrowser document.execCommand approach. It can be unreliable, poses security risks, and may lack proper support in newer Windows environments.
How do I correctly display the converted text in my VB.NET RichTextBox?
Once your HTML string is properly converted to RTF syntax, you must assign the result directly to the RichTextBox.Rtf property rather than the RichTextBox.Text property to ensure the formatting renders correctly.
Does WPS Office support saving files as RTF or HTML?
Yes, WPS Writer allows you to open, edit, and save documents in both RTF and HTML formats, making it easy to inspect or manually convert rich text files outside of programmatic .NET environments.




