Document Editor takes advantage of system clipboard and allows you to copy or move a portion of the document into it in HTML format, so that it can be pasted in any application that supports clipboard.
Copy a portion of document to system clipboard using built-in context menu of Document Editor. You can also do it programmatically using the following sample code.
documentEditor.selection.copy();
Cut a portion of document to system clipboard using built-in context menu of Document Editor. You can also do it programmatically using the following sample code.
documentEditor.editor.cut();
Due to limitations, you can paste contents from system clipboard in Document Editor only using the ‘CTRL + V’ keyboard shortcut.
Note: Due to browser limitation of getting content from system clipboard, paste using API and context menu option doesn’t work.
Document Editor expose API to enable local paste within the control. On enabling this, the following is performed:
Refer to the following sample code.
//Initialize the Document Editor.
let editor: DocumentEditor = new DocumentEditor({ enableEditor: true, isReadOnly: false, enableSelection: true });
//Enable the local paste.
editor.enableLocalPaste = true;
By default, enableLocalPaste is false. When local paste is enabled for a Document Editor instance, you can paste contents programmatically if the internal clipboard has stored data during last copy operation. Refer to the following sample code.
documentEditor.editor.paste();
In Document editor, paste options in context menu will be in disabled state if you were try to copy/paste content from outside of Document editor. It gets enabled when enableLocalPaste is true and trying to copy/paste content inside Document editor.
Note: Due to browser limitation of getting content from system clipboard, paste using API and context menu option doesn’t work. Hence, the paste option is disabled in context menu. Alternatively, you can use the keyboard shortcuts,
EnableLocalPaste | Paste behavior details |
---|---|
True | Allows to paste content that is copied from the same Document Editor component alone and prevents pasting content from system clipboard. Hence the content copied from outside Document Editor component can’t be pasted. Browser limitation of pasting from system clipboard using API and context menu options, will be resolved. So, you can copy and paste content within the Document Editor component using API and context menu options too. |
False | Allows to paste content from system clipboard. Hence the content copied from both the Document Editor component and outside can be pasted. Browser limitation of pasting from system clipboard using API and context menu options, will remain as a limitation. |
Note:
Document Editor provides support to paste the system clipboard data with formatting. To enable clipboard paste with formatting options and copy/paste content from outside of Document editor, set the enableLocalPaste
property in Document Editor to false and use this .NET Standard library Syncfusion.EJ2.WordEditor.AspNet.Core
by the web API service implementation. This library helps you to paste the system clipboard data with formatting.
Refer this page for more details.
You can paste your system clipboard data in the following ways:
This paste option appear as follows.