Pasting Content from LibreOffice
This feature is provided through the Paste from LibreOffice plugin that is included in the Standard and Full presets available from the official CKEditor 4 Download site. You can also add it to your custom build with online builder.
The Paste from LibreOffice plugin allows you to paste content from LibreOffice Writer and maintain original content structure and formatting.
When enabled, it automatically detects LibreOffice Writer content and transforms its structure and formatting to clean HTML.
# Supported Features
Paste from LibreOffice retains the following formatting:
- Text formatting
- Text and background colors
- Font family, style and size
- Basic formatting (bold, italic, underline)
- Font effects (strikethrough, superscript, subscript)
- Heading levels
- Text alignment
- Numbered and bulleted lists
- Multilevel lists
- Different numbering formats (Roman, decimal, alphanumeric)
- Custom start number (e.g. you can start the list from number 4)
- Borders and shading
- Cell size (width and height)
- Cell alignment
The Paste from LibreOffice plugin maintains most of LibreOffice Writer text formatting features with some exceptions related to advanced styling, customizations, or styles that are not supported by HTML.
The plugin is supported only in Google Chrome, Mozilla Firefox and Microsoft Edge browsers. In Safari and Internet Explorer it is not possible to detect if the content is copied from LibreOffice Writer. However, even without the official support for the plugin, most of the formatting should be preserved correctly upon pasting in these browsers.
The following sample content from a LibreOffice Writer document:
will look like below after pasting to CKEditor 4 with the Paste from LibreOffice plugin enabled:
Here is another sample with some more complicated formatting and styling as well as an image:
It will look like this after pasting into CKEditor 4:
HTML exposed by LibreOffice Writer does not fully comply to rules of valid and semantic HTML. Therefore, a separate filter had to be created to normalize this content. It is implemented in the Paste from LibreOffice plugin.
# Paste from LibreOffice Demo
See the working “Pasting content from LibreOffice” sample that showcases the Paste from LibreOffice plugin.
# Related Features
Refer to the following resources for more information about pasting content:
- The Pasting content from Microsoft Word article contains more information about the Paste from Word feature.
- The Pasting content from Microsoft Excel article contains more information about the Paste from Excel feature.
- The Pasting content from Google Docs article contains more information about the Paste from Google Docs feature.
- The Clipboard Integration article explains how Clipboard API is implemented in CKEditor 4.
- The Uploading Dropped or Pasted Files article describes drag&drop in CKEditor 4.
- The Content Filtering (ACF) is an introduction to CKEditor’s unique content filtering system.
- The Applying Styles to Editor Content article discusses creating more semantically correct text styles.