Converting rich text that contains backslashes to plain text or html

Posted by Allison on Stack Overflow See other posts from Stack Overflow or by Allison
Published on 2010-05-15T13:43:54Z Indexed on 2010/05/15 14:14 UTC
Read the original article Hit count: 339

Filed under:
|
|

I am trying to convert a rich text string to plain text or html. I am currently using the RichTextBox.Text feature which works correctly for almost all cases except when the text contains backslashes then some of the text is stripped out as the converter believes that it is part of the rtf formatting. Does anyone have any ideas of how to get the backslashes to stay in that instance. Here is an example of a string I would have

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\fs17 Testing Export \with comments\par}

The text I would need would be "Testing Export \with comments" and the text I am getting back from the rtf converter is "Testing Export comments". Any help would be greatly appreciated. Please respond if you have further questions.

© Stack Overflow or respective owner

Related posts about rtf

Related posts about backslash