In RadRichTextEditor:
In Word:
This is the used code snippet:
static void Main(string[] args)
{
Telerik.WinForms.Documents.Model.RadDocument templateDocument = GetDocument("Template.rtf");
Telerik.WinForms.Documents.Model.RadDocument contentDocument = GetDocument("Content.rtf");
Telerik.WinForms.Documents.Model.Merging.InsertDocumentOptions options = new Telerik.WinForms.Documents.Model.Merging.InsertDocumentOptions();
options.ConflictingStylesResolutionMode = Telerik.WinForms.Documents.Model.Merging.ConflictingStylesResolutionMode.RenameSourceStyle;
options.InsertLastParagraphMarker = true;
Telerik.WinForms.Documents.Model.RadDocumentEditor templateEditor = new Telerik.WinForms.Documents.Model.RadDocumentEditor(templateDocument);
templateEditor.InsertFragment(new Telerik.WinForms.Documents.Model.DocumentFragment(contentDocument));
string mergedDocumentFilePath = "MergeDocumentsWithRichTextEditor.rtf";
File.Delete(mergedDocumentFilePath);
WriteDocToFile(templateDocument, mergedDocumentFilePath);
}
private static Telerik.WinForms.Documents.Model.RadDocument GetDocument(string rtfFilePath)
{
Telerik.WinForms.Documents.Model.RadDocument document = null;
var rtfImporter = new Telerik.WinForms.Documents.FormatProviders.Rtf.RtfFormatProvider();
using (Stream stream = File.OpenRead(rtfFilePath))
{
document = rtfImporter.Import(stream);
}
return document;
}
private static void WriteDocToFile(Telerik.WinForms.Documents.Model.RadDocument doc, string filename)
{
var rtfExporter = new Telerik.WinForms.Documents.FormatProviders.Rtf.RtfFormatProvider();
string rtfText = rtfExporter.Export(doc);
File.WriteAllText(filename, rtfText);
Process.Start(filename);
}
Observed result:
Expected result: keep the After spacing as it is in the original documents.
In the Fluent theme, the Font Size Dropdown of the SelectionMiniToolBar is not wide enough.
MS Word offers "Go To" option in its Find and Replace dialog:
It is reasonable to add similar scrolling behavior when navigating in document, programatic scrolling and GoTo~() methods.
In MS Word, text is hidden using the Home -> Font -> Font -> Effects -> Hidden.
In the Rtf format, such text is preceded (marked) with a '\v' tag. In OOXML, the tag is <vanish/>. The display: none; style from HTML is mapped to hidden text when document is converted to DOCX.
Add support for importing of imaged defined with VML's v:imagedata inside v:image or v:shape. Currently, such images are just skipped.
A possible workaround is to upgrade the documents to a newer DOCX compatibility setting (by re-saving them with MS Word for example), where such shapes are not allowed and are replaced with more modern constructs which the import of RadRichTextEditor supports.