Retrieving the RTF from NRichTextViewWithRibbonControl


https://www.nevron.com/Forum/Topic12411.aspx
Print Topic | Close Window

By Steven Paplanus - 3 Years Ago
I have a project where I need to save and load data from a Winforms app to a database, where a documentation form was built with the NRichTextViewWithRibbonControl that would be saved with the rest of the project information I need to persist.   I have been looking for a while, but can't seem to find a way to either send/retrieve or stream the RTF data from the control.  Is there any way to make this work?
By Nevron Support - 3 Years Ago

Hi Steven,
All WPF / Winform controls in NOV are actually NOV hosts that wrap a certain NOV Widget. This Widget is exposed from the typed Widget property of the control. In the case of the "NRichTextViewWithRibbon" control this Widget is of type NRichTextViewWithRibbon. This widget in turn contains View and Ribbon properties that expose the functionality of the ribbon and the rich text view. So back to your question in oder to load / save content from the view you need to write something like:

nRichTextViewWithRibbonControl1.Widget.View.LoadFromFile("c:\\temp\\test.rtf");

You can also import rtf/docx etc. from in memory streams (this is the case when you read the content from a database for example):
nRichTextViewWithRibbonControl1.Widget.View.LoadFromStream(someStream, new NRtfTextFormat());

Hope this helps - let us know if you meet any problems or have any questions.

By Steven Paplanus - 3 Years Ago
Perfect, that worked.  Thank you for you help.