What is the best what to copy text from one document to another

Print Topic | Close Window

By Mike Willis - Last Year
I am using OpenVision Enterprise
What is the recommended way to copy text from one document to another, both opened in memory?
Specifically i want to do a mail merge in one document, and copy the resulting merge to another document.
Mike Willis

By Nevron Support - Last Year
Hi Mike,
There are generally two ways to do this fast:
1. You can use deep clone on the view.Content for example:
NDocumentBlock block = (NDocumentBlock)nRichTextViewWithRibbonControl1.View.Content.DeepClone();
nRichTextViewWithRibbonControl2.View.Content = block;
2. You can save / load the document to a memory stream:
MemoryStream memoryStream = new MemoryStream();
nRichTextViewWithRibbonControl1.View.SaveToStream(memoryStream, new NNevronXMLTextFormat(), null);
memoryStream.Seek(0, SeekOrigin.Begin);
nRichTextViewWithRibbonControl2.View.LoadFromStream(memoryStream, new NNevronXMLTextFormat());

We would recommend you to use the first approach as there is no added overhead of XML formatting. Let us know if you have any questions.