How to convert a rich text field to plain text
A tool is available which will remove all rich text formatting from a notes field so that it is plain text instead. This can be useful if, for example, you wish to display data from a notes field on a report, since Reporting Services does not automatically handle rich text formatting.
It is important to note that this tool will convert ALL data in ALL rows for the field you specify. The conversion is irreversible, although text can still be manually given rich text formatting as normal afterwards. Therefore a backup of the database should be taken before using this tool.
The tool can be downloaded here.
Once downloaded, unzip the contents of the zip file to a location on your hard drive. For this example we will use C:\RichTextFix.
The tool is run from a command prompt:
- In Windows, click the Start button.
- Enter cmd in the search box and press enter.
- A command prompt will open. Navigate to the folder where you extracted the files by entering cd, a space, then the file path (then press enter). For example, cd c:\RichTextFix.
-
Enter MemoEditRichText and press enter. This will display the list of parameters that the tool uses.
The mandatory parameters are as follows:
- server - The SQL server which holds the Maytas database.
- database - The name of the Maytas database.
- uname - The SQL server user (this should be Maytas3).
- pword - The password for the Maytas3 user.
- table - The table which holds the field you wish to convert.
- column - The field you wish to convert.
There are also two optional parameters:
- startpost - If a number is entered for this parameter, the conversion will only be applied from that row number onwards.
- removecr - If this is set to Y, carriage returns will be removed from the text formatting.
For example, to convert the NOTES field on the VISITS table on a database called MaytasDB on a SQL server called MyServer\Instance, you would enter the following in the command prompt:
MemoEditRichText -server=MyServer\Instance -database=MaytasDB -uname=Maytas3 -pword=password -table=visits -column=notes
When you press enter, all data in the field will be converted to plain text. Please note that for fields with a lot of rows, this may take a short while (e.g. over 10 minutes).