Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

3 Answers

up vote 2 down vote accepted

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

share|improve this answer
add comment

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

box.Text.SubString(0,50)
share|improve this answer
add comment

SPHttpUtility.ConvertSimpleHtmlToText().SubString(0,50)

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

Your Answer

 
discard

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.