0

I have updated net framework to 4.8 from 4.5 and noticing Richtextbox is not parsing certain tags in rtf like \colortbl, \stylesheet and so on

All I am doing is passing rtf text to richtextbox to retrieve text from it. Rtf has certain tags listed above which doesn't get parsed in 4.8 framework but it gets parsed when I downgrade to 4.5

var rtb = new RichTextBox {Rtf = t}; string s = rtb.Text;

DLL used for richtextbox control is System.Windows.Form dll

Any idea how to over come this problem?

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Vihana Kewalramani
  • 915
  • 11
  • 14
  • .Net Framework 4.5 use `RichEdit20W`, while .Net Framework 4.8 use `RichEdit50W` (same as Wordpad, so verify that this app can parse your RTF). -- You *could* demote a RTB Control to the previous version. See the examples [here](https://stackoverflow.com/a/29488625/7444103) and [here](https://stackoverflow.com/a/18668921/7444103). You should load, IIRC, `\System32\riched20.dll`, not `MsftEdit.dll` – Jimi Dec 20 '21 at 09:13
  • Set the `AppContextSwitchOverrides` switch `DoNotLoadLatestRichEditControl` in the app config file. See this [answer](https://stackoverflow.com/a/56938772/2592875) for the syntax. – TnTinMn Dec 20 '21 at 14:48
  • Thank you Jimi and TnTinMn for your suggestions. I got it resolved by switching to old dll during runtime. Really appreciate for you responses. – Vihana Kewalramani Dec 20 '21 at 23:26

0 Answers0