I'd like to load ans save a rtf file from my sql server database....
When I was in Winforms, I had the "rtf" members from the RichTextBox that was helpful.
How could I achieve this with the RadRichTextBox ?
Thanks, it helped me, but I’m still not able to do what I want....
I’d like to store the rtf file in a database field (Nvarchar(max)). So, I created a RtfFormatProvider, but all I can do is import/export as string and not as a file (radRichTextBox1.Document = d.Import(myField) & myfield = d.Export(radRichTextBox1.Document)).
How can I import/export from/to my database as a rtf file ? The Export and Import have a stream parameter, but where does this stream come from ?
Thank you for any advice.
Xavier
0
Iva Toteva
Telerik team
answered on 16 Nov 2011, 04:56 PM
Hello Xavier,
As described in the article on format providers that Boby quoted for reference, most format providers have overload methods for import and export from/to stream, byte[] and string. This is also the case with RtfFormatProvider. In short, you can import and export the content of a document using a stream in the following way:
The stream can be a MemoryStream you have created, the Stream of a SaveFileDialog (in that case the content of the document is written to the file chosen in the SaveFileDialog) or any other stream you have writing permissions to.
However, when it comes to saving the content of a document in a database, what you really need is the string result of the export of the document. After having exported the document to a string, you can use this string to fill the field in the database.
All the best,
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>