Copy and Paste
Firefox Compatibility Note
Firefox does not support clipboard.readText()
, see MDN. In this case, Univer can only retrieve clipboard content from the paste event, thus only supporting keyboard shortcut pasting.
Univer uses the Clipboard API to implement copy and paste functionality, supporting copying and pasting from external applications to Univer, from Univer to external applications, and between Univer Sheets.
Security Context Requirement
Due to modern browser security policies, the Clipboard API can only be used in secure contexts (such as HTTPS).
Univer supports the following copy and paste operations:
- Copying and pasting from external applications to Univer
- Copying from Univer to external applications
- Copying and pasting between Univer Sheets
And supports the following selective paste capabilities:
- Paste values only
- Paste formats only
- Paste column widths only
- Paste content excluding borders only
- Paste formulas only
Disable Copying
Univer allows developers to disable the copy functionality for users in a workbook or specific sheets through permission control.
For example, the following code disables the copy functionality for users in the current workbook:
const workbook = univerAPI.getActiveWorkbook()
const permission = workbook?.getPermission()
if (workbook && permission) {
const unitId = workbook.getId()
const WorkbookCopyPermission = permission.permissionPointsDefinition.WorkbookCopyPermission
permission.setWorkbookPermissionPoint(unitId, WorkbookCopyPermission, false)
}
For more information on permission control, please refer to the Permission Control documentation.
How is this guide?