WYSIWYG HTML editor for Winforms

Hi there, I've noticed that there is RichTextEditor for ASP (http://mvc.syncfusion.com/demos/ui/tools/RichTextEditor/BasicCustomization). Do You have similar control for WinForms?
I am looking for a control that will allow me to compose email from WinForms application. I found some solution over the internet, for examplehttps://www.codeproject.com/Articles/15559/A-Windows-Forms-based-text-editor-with-HTML-output but I'd prefer something that is professionally written by You.
I want to create experience similar to Outlook, where I'll be able to read emails from mailbox and take actions depending on messages, one of actions must be responding to email. If such control isn't currently available please let me know do You guys plan to add such control, if Yes what is time frame to wait for it.

Sorry for choosing TextBoxExt as Control, but I must choose something, there isn't option for other.

Best regards,
Tomasz

5 Replies

VM Venkatesan Mani Syncfusion Team November 21, 2017 06:49 AM UTC

Hi Tomasz Jagusz,

Thank you for contacting Syncfusion support.

At present, there is no Syncfusion rich text editor component available in Windows Forms. However you can use our WPF SfRichTextBoxAdv control in your windows forms application using ElementHost. The SfRichTextBoxAdv control allows you to view, edit, and print rich text contents, and also import and export the Html, Xaml, Text files and Word documents (".doc", ".docx", ".rtf"). for further information about SfRichTextBoxAdv control, kindly refer the below UG link,

UG link: https://help.syncfusion.com/wpf/sfrichtextboxadv/getting-started

We have already published an KB article to show how to use SfRichTextBoxAdv in Windows Forms application. Please refer the KB article from following link,

https://www.syncfusion.com/kb/5909/how-to-use-wpf-sfrichtextboxadv-control-in-windows-forms-application

You can also export the SfRichTextBoxAdv content as Html text and send the html text as mail. Please refer the following KB links for the same.,

https://www.syncfusion.com/kb/5415/how-to-implement-htmltext-property-for-sfrichtextboxadv-control
https://www.syncfusion.com/kb/6303/how-to-create-mail-messages-using-sfrichtextboxadv-control

We have also prepared the sample to demonstrate your requirements and attached in the following link.

Sample link:
Sample.zip.

Try running sample and let us know if this helps you.

Regards,
Venkatesan M. 



DW Dave Wurtz replied to Venkatesan Mani December 4, 2017 03:29 PM UTC

Hi Tomasz Jagusz,

Thank you for contacting Syncfusion support.

At present, there is no Syncfusion rich text editor component available in Windows Forms. However you can use our WPF SfRichTextBoxAdv control in your windows forms application using ElementHost. The SfRichTextBoxAdv control allows you to view, edit, and print rich text contents, and also import and export the Html, Xaml, Text files and Word documents (".doc", ".docx", ".rtf"). for further information about SfRichTextBoxAdv control, kindly refer the below UG link,

UG link: https://help.syncfusion.com/wpf/sfrichtextboxadv/getting-started

We have already published an KB article to show how to use SfRichTextBoxAdv in Windows Forms application. Please refer the KB article from following link,

https://www.syncfusion.com/kb/5909/how-to-use-wpf-sfrichtextboxadv-control-in-windows-forms-application

You can also export the SfRichTextBoxAdv content as Html text and send the html text as mail. Please refer the following KB links for the same.,

https://www.syncfusion.com/kb/5415/how-to-implement-htmltext-property-for-sfrichtextboxadv-control
https://www.syncfusion.com/kb/6303/how-to-create-mail-messages-using-sfrichtextboxadv-control

We have also prepared the sample to demonstrate your requirements and attached in the following link.

Sample link:
Sample.zip.

Try running sample and let us know if this helps you.

Regards,
Venkatesan M. 


We are looking for a similar solution - WinForms application with rich email capabilities.  I've tried the sample that you have provided and it looks good with the exception of being able to paste images.  When I paste an image into the rich edit control, it usually will display but then the application locks up when trying to update the HTML source.  This happens regardless of the size of the image.

Is pasting of images from the clipboard something that can be handled in the sample application?

Thanks.
Dave


VM Venkatesan Mani Syncfusion Team December 5, 2017 12:45 PM UTC

  
Hi Dave,

Thank you for contacting Syncfusion support.

We have modified the sample to resolve the exception when updating the Html source after pasting the image in SfRichTextBoxAdv control. Please find the modified sample from the below link,

Sample link:
Sample_updated.zip

Regarding “Is pasting of images from the clipboard something that can be handled in the sample application?”:
You can customize the pasting of the images from the clipboard using a button click. In a button click event, you can access the clipboard data(image) and insert in SfRichTextBoxAdv control using the Selection insert API’s or commands (parameter object type can be a byte[], Stream , Uri, Image, BitmapImage or FileInfo).Please refer the below API reference link for further information.

Clipboard : https://docs.microsoft.com/en-us/dotnet/framework/winforms/advanced/how-to-retrieve-data-from-the-clipboard
Selection API: https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SelectionAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SelectionAdv_InsertPicture_System_Object_
Command: https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_InsertPictureCommand

Sample code snippet(C#): 
private void Button_Click(object sender, RoutedEventArgs e) 
{ 
    try 
    { 
        if (Clipboard.ContainsImage()) 
        { 
            //Gets image from clipboard. 
            BitmapSource bmp = Clipboard.GetImage(); 
            Image img = new Image(); 
            img.Source = bmp; 
            // Insert image in SfRichTextBoxAdv control. 
            richTextBoxAdv.Selection.InsertPicture(img); 
        } 
    } 
    catch 
    { } 
} 


Regards,
Venkatesan M.

 



DW Dave Wurtz December 15, 2017 05:00 PM UTC

Thank you for the updated example.  We're getting very close, but I still have a problem.

When I send the email, the images will not appear in Microsoft Outlook (GUI client or Web client).  However, if I view the email on an iPhone in the default iOS email application, the image shows.  If I take the Outlook email and save the source to an HTML file, when I open it, the image also appears.  It appears that the sending of the embedded image to an Outlook client is not working quite right.  I have attached a .zip file of the following:
  • .jpg - screenshot of how the email appears from Outlook GUI client (image does not show)
  • .msg - the Outlook email (image does not show)
  • .html - the Outlook email's source (right mouse click, View Source) and then saved the text as .HTML file (properly shows image)
Thank you for looking into this.
Dave

Attachment: HTML_Email_Doesn't_Show_Image_69f285a2.zip


VM Venkatesan Mani Syncfusion Team December 18, 2017 11:19 AM UTC

Hi Dave,

Thank you for your update.

Our SfRichTextBoxAdv will export all the images except the web images as embedded (base64 string) in HTML. Since Microsoft word and outlook does not support base64 string images, they will render a placeholder image. However, Microsoft Word/Outlook supports online images. Using the event “ImageNodeVisitedEvent” of SfRichTextBoxAdv, you can process the image stream and upload the images in your server. Also, you can specify the web url’s of the image to be exported in HTML instead of base64 string. If you wish to support the images in Microsoft Word/Outlook, kindly process the image stream and use online images. Please find the sample code below, 

Sample code(C#): 
// Hooks the image node visited event to process the images of the documents on html export. 
richTextBoxAdv.HtmlImportExportSettings.ImageNodeVisited += HtmlImportExportSettings_ImageNodeVisited; 
 
 
// Event implementation. 
private void HtmlImportExportSettings_ImageNodeVisited(object obj,ImageNodeVisitedEventArgs args) 
{ 
    if (args.Stream != null) 
    { 
        // You can process this stream to save it in local file system or upload it online server. 
        MemoryStream stream = new MemoryStream(); 
        // Save the image strea to new image file. 
        args.Stream.CopyTo(stream); 
        stream.Position = 0; 
        // Todo: Process the stream, Upload it to online. 
        // Get the online link. 
        // Set the new image web url path as source.This url path will be written in exported HTML. Example "http://www.website.com/image1.jpg". The images in the html body only can be viewed in online. Since, the images are online images. 
.
 
        args.Source = "http://www.website.com/image1.jpg"; 
        // Dispose stream. 
        stream.Dispose(); 
    } 
} 
 
For more information about “ImageNodeVisitedEvent”, Please refer the following API reference link.

https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.HtmlImportExportSettings.html
https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.ImageNodeVisitedEventArgs.html


 
Regards,
Venkatesan M. 


Loader.
Up arrow icon