SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to copy only first 5o characters from the richtextboxA to either a textbox or richtextboxB.... in a visual webpart ..the richtextboxA can have images,tables formating,html, blank spaces.. if it is html text shud be converted to normal text..blank spaces shud be truncated,table images shud be skipped ...from the previous post i have been using String.Join("\n", respRichTextBox.Text.Split('\n').Take(2).ToArray()) this takes the first two line from a richtextbox...but due to change in requirement this code wud need some modification..any suggestions?

share|improve this question
up vote 2 down vote accepted

You can use this great class: SPHttpUtility.ConvertSimpleHtmlToText()

share|improve this answer

I'm not entirely certain what you are doing here but why not do something simple like:

share|improve this answer


share|improve this answer
Thanks a lot guys!, SPHttpUtility.ConvertSimpleHtmlToText() worked like a Gem.... – spStacker Feb 10 '12 at 16:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.