Click here to Skip to main content
16,023,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a problem while accessing rtf content to wpf RihtextBox the content formatting has lost.....

i have done it with other way but i want to do it with rtf format.....



any help will be sufficient...
Thanks....
Posted
Updated 30-Oct-12 5:21am
v2
Comments
Sushil Mate 30-Oct-12 7:23am    
show us the code?

1 solution

Try this:-

TextRange tr = new TextRange(myRichTextBox.Document.ContentStart,
myRichTextBox.Document.ContentEnd);
MemoryStream ms = new MemoryStream();
tr.Save(ms, DataFormats.Xaml);
string xamlText = ASCIIEncoding.Default.GetString(ms.ToArray());
EDIT: I don't have code in front of me to test, but an instance of the TextRange type has a Save (to stream) method that takes a DataFormats parameter, which can be DataFormats.Rtf

This is not my answer but it is a copy from someother!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900