C# Remove RTF formatting from a string

Hi.. I'm trying to remove all RTF formatting from a string (The source is Word Document - with all the 'garbage' Word adds).
But I get invalid file format.  Any ideas..

   string x = @"<html>  <head>   <style type='text/css'>    .c0 { margin-left:0pt;margin-top:0pt;margin-right:0pt;margin-bottom:7.5pt; }    .c1 { font-size:16pt; }    .c2 { font-size:7.5pt;text-decoration:underline; }    .c3 { font-family:'Times New Roman';font-size:48pt; }   </style>  </head>  <body>  <p class='c0'>Hellow</p>  <p class='c0'></p>  <p class='c0'>asdfdafdf</p>  <p class='c0'></p>  <p class='c0'><span class='c1'>fadsfdafdf</span></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'><span class='c2'>asdffasdf</span></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'></p>  <p class='c0'><span class='c3'>asdfafdasf</span></p>  </body>  </html>  ";
            System.Windows.Forms.RichTextBox rtfBox = new System.Windows.Forms.RichTextBox();
       
            rtfBox.Rtf = x.Trim();
            x = rtfBox.Text.ToString().Trim();
            MessageBox.Show(x);
LVL 1
JElsterAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SriVaddadiCommented:
what is your approach and what is not working?
0
JElsterAuthor Commented:
I use the System.Windows.Forms.RichTextBox to load the string and 'get' the string.
The enclose code does not work
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SriVaddadiCommented:
It does not work that way.  Try loading the text into a normal text box. I am sure if that works either but you could try. Do you have to programmatically do it? or you could open word and save as ordinary document.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.