RichTextBox: Implement conversion between RadDocument and RadFlowDocument
Add a way to convert between RadRichTextBox's RadDocument and RadWordsProcessing's RadFlowDocument.
This will enable integration scenarios between the two products, including using RadWordsProcessing's format providers for import and export.
10 comments
ADMIN
Dimitar
Posted on:03 Jul 2023 05:34
Hi Leighton,
Please note that we have two HTML format providers with the same name from different namespaces. In your case to create a RadDocuemnt use the one from the Telerik.WinForms.Documents.FormatProviders.Html namespace. The other one is from the WordsProcessing library used for editing documents in the code behind.
I hope this helps. Should you have any other questions do not hesitate to ask.
This still seems to be an issue in WinForms 2023.2.519.40. Im trying to export and import the RichTextEditor into SQL, however the Import converts the html string to RadFlowDocument which isnt compatible with the RichTextEditor Rad Document.
Is there a work around please?
Thanks
ADMIN
Tanya
Posted on:19 Apr 2022 10:35
Hi all,
Are there scenarios in which the import and export capabilities don't fit your requirements? We are currently thinking that using the format provider classes of the two components would be a good enough solution for the conversion and would like to check whether there is something additional you might need. Any input on the specific needs will be appreciated.
Regards,
Tanya
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
ADMIN
Dimitar
Posted on:31 May 2021 08:30
Hello Joshua,
The DocFormatProvider is part of the DocumentProcessing library which is a separate library that is not connected to the RadRichTextBox. Currently, the possible solution is to use the DocumentProcessing library to convert the document to DOCX and then open it in RadRichTextBox.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Joshua
Posted on:29 May 2021 20:31
The new DocFormatProvider produces a RadFlowDocument which is not compatible with RadRichTextBox. I'm confused why it was done this way because DocxFormatProvider produces a RadDocument which IS compatible. Regardless, it's another reason to implement this feature formally.
ADMIN
Dimitar
Posted on:10 Dec 2020 11:11
Hi Hilton,
Yes, this is still not implemented, it has a lot of votes, I am sure that it will be implemented in one of the future releases.
I can suggest a workaround that uses the docx format for the conversion for now:
privatevoidRadButton_Click(object sender, RoutedEventArgs e)
{
var rtbProvider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
var wordsProcessingProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var radDocument = radRichTextBox.Document;
var docBytes = rtbProvider.Export(radDocument);
var flowDocument = wordsProcessingProvider.Import(docBytes);
}
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hilton
Posted on:09 Dec 2020 19:52
4 years later and seems this still hasn't been added. Sure could use it about now.
ADMIN
Tanya
Posted on:13 Oct 2016 09:03
Hi Peter,
You can implement this scenario using the HtmlFormatProvider of RadRichTextBox.
In order to use this provider, you need to add a reference to the Telerik.Windows.Documents.FormatProviders.Html assembly and a using directive for the Telerik.Windows.Documents.FormatProviders.Html namespace.
You might find helpful to check the Import/ Export article of RadRichTextBox for more information about the functionality: http://docs.telerik.com/devtools/wpf/controls/radrichtextbox/import-export/features-import-export
Regards,
Tanya
Peter
Posted on:10 Oct 2016 19:09
I really want from RadFlowDocument to RadDocument so i can set my RadRichTextBox.Document = htmlFormatProvider.Import("my html text);
Is there another way to do this for now?