Copy from MS Word and Paste to Editor

The formatting toolbar gives you an option to paste copied text from MS Word documents. Special algorithms replicate the formatting style of MS Word and at the same time ensure that the HTML code produced is clean and easy to read and manage. The screenshot below shows source MS Word content that will be pasted into the editor. As you can see, it contains images, various fonts, font formatting, lists:

Word content

The button pointed by the arrow in the image below is used for this feature. Simply copy the text from any MS Word document and press the button in the WPF Editor. It will paste the content into the Editor preserving the formatting style of MS Word.

Content pasted from Word

Below is the HTML code for the above content. You can see that the HTML code is clean and easy to read.

HTML pasted from Word

To enable this programmatically, you can use the following code snippet.

C#

private void button1_click(object sender, RoutedEventArgs e)
{
    htmlEditor1.ToolbarItemOverrider.OnPasteFromMSWordButtonClicked(sender, e);
}

VB.NET

Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    htmlEditor1.ToolbarItemOverrider.OnPasteFromMsWordButtonClicked(sender, e)
End Sub
Last updated on 29 May 2015, Friday, 4:28:51 AM
If you have any questions or concerns about this tutorial, Please feel free to share your comment.