Ticket T354611
Visible to All Users

How save the text of a Rich Edit Control in database

created 9 years ago

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

Answers approved by DevExpress Support

created 9 years ago (modified 9 years ago)

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.

    Comments (2)

      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

      Maria Nikulina (DevExpress) 9 years ago

        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.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.