Copy and Paste
Firefox Compatibility Note
Firefox does not support clipboard.readText(). See MDN for details. In that case Univer reads the clipboard from the paste event, so pasting works only with the keyboard shortcut.
Univer implements copy and paste with the Clipboard API. Content can be copied from external applications into Univer, from Univer into external applications, and between Univer Sheets.
Security Context Requirement
Modern browser security policies allow the Clipboard API only in a secure context, such as HTTPS.
Univer supports the following copy and paste operations:
- Copy and paste from external applications into Univer
- Copy from Univer into external applications
- Copy and paste between Univer Sheets
Selective paste covers these cases:
- Paste values only
- Paste formats only
- Paste column widths only
- Paste content without borders only
- Paste formulas only
In the desktop Ribbon, the Paste dropdown next to undo and redo provides normal paste, paste values, paste formats, paste column widths, and paste without borders. Its menu ID is sheet.menu.paste; the context-menu Paste special entry uses sheet.menu.paste-special. The Ribbon dropdown is hidden while you edit shape text.
Disable copying
Permission control can disable copying for an entire workbook or for specific worksheets.
The following code disables copying for the current workbook:
const workbookPermission = univerAPI.getActiveWorkbook()?.getWorkbookPermission()const WorkbookCopyPermission = univerAPI.Enum.WorkbookPermissionPoint.CopyContentif (workbookPermission) { workbookPermission.setPoint(WorkbookCopyPermission, false)}For more information about permissions, see Permission Control.
How is this guide?