Hi, I am working with the XtraRichEdit.RichEditControl and I need save the text with the format in the database, to show it in several places later, with the same RichEditControl control.How can save the text in the database con keep the text format?kind regards Matias
How save the text of a Rich Edit Control in database
Answers approved by DevExpress Support
Hello Matias,
To accomplish this task, I recommend you save RichEditControl's document to the stream in the Rtf format using the RichEditControl.SaveDocument(Stream, DocumentFormat) method. After that, you will be able to save stream bytes to the database.
To restore the document in RichEditControl later, read bytes array from the database to a stream and load the document from this stream using the RichEditControl.LoadDocument(Stream, DocumentFormat) method. Note that it's also necessary to use the Rtf document format in this method.
I hope that you find this information helpful.
Good Answer, thanks.I found a better solution using the Rtf Text property of this control to save as string in the database and binding to the same property on load method.Thanks again.Matias
Yes, this approach is also correct. In any case, the decision is up to you.
Please do not hesitate to contact us in the future.