Pasting content from Microsoft Office
Paste from Office features let you paste content from Microsoft Word and Microsoft Excel and preserve its original structure and formatting. This is an advanced, premium paste from Office enhanced feature.
Unlock this feature with a CKEditor Paid Plan. Sign up for a free trial, or select the Plan that provides access to all the premium features you need.
There is also the basic, open-source Paste from Office feature, You can read more about the differences between these two further in this guide.
# Demo
Use these sample documents to test pasting from Microsoft Office:
To test pasting from Office, download the sample documents and open them in Microsoft Office applications. Then, copy the content and paste it into the editor below.
This demo presents a limited set of features. Visit the feature-rich editor example to see more in action.
# Content formatting support
Paste from Office enhanced retains rich content pasted from Microsoft Office applications. See below the full table of supported styles and formatting.
# Microsoft Word
Note: The name of each group in the table corresponds to the category in Word’s “Modify style” user interface. If a specific formatting is supported natively (without using the General HTML Support feature), a plugin name responsible for the formatting is provided in parentheses.
The basic paste from Office feature only supports inline formatting, introduced via the Microsoft Word user interface. It does not support Word styles.
The paste from Office enhanced feature supports both.
Group | Formatting | Paste from Office | Premium feature Paste from Office enhanced | |
---|---|---|---|---|
Native support | With General HTML Support | |||
Font | Font family | ✅ Yes | ✅ Yes (FontFamily ) |
✅ Yes |
Font style (weight, italic) | ✅ Yes | ✅ Yes (Bold , Italic ) |
✅ Yes | |
Font size | ✅ Yes | ✅ Yes (FontSize ) |
✅ Yes | |
Text color | ✅ Yes | ✅ Yes (FontColor ) |
✅ Yes | |
Underline | ✅ Yes | ✅ Yes (Underline ) [1] |
✅ Yes [1] | |
Advanced underline | ❌ No | ✅ Yes (Underline ) [2] |
✅ Yes [2] | |
Emphasis mark | ❌ No | ❌ No | ✅ Yes | |
Strikethrough | ✅ Yes | ✅ Yes (Strikethrough ) |
✅ Yes | |
Double strikethrough | ❌ No | ✅ Yes (Strikethrough ) [3] |
✅ Yes (Strikethrough ) [3] |
|
Superscript | ✅ Yes | ✅ Yes (Superscript ) |
✅ Yes | |
Subscript | ✅ Yes | ✅ Yes (Subscript ) |
✅ Yes | |
Small caps | ❌ No | ❌ No | ✅ Yes | |
All caps | ❌ No | ❌ No | ✅ Yes | |
Hidden | ❌ No | ❌ No | ✅ Yes | |
Character scale | ❌ No | ❌ No | ❌ No | |
Character spacings | ❌ No | ❌ No | ✅ Yes | |
Advanced typography | ❌ No | ❌ No | ❌ No | |
Paragraph | Alignment | ✅ Yes | ✅ Yes (Alignment ) |
✅ Yes |
Indentation left | ✅ Yes | ✅ Yes (IndentBlock ) |
✅ Yes | |
Indentation right | ❌ No | ❌ No | ✅ Yes | |
Spacing before | ❌ No | ❌ No | ✅ Yes | |
Spacing after | ❌ No | ❌ No | ✅ Yes | |
Line spacing | ❌ No | ❌ No | ✅ Yes | |
Line spacing at | ❌ No | ❌ No | ✅ Yes | |
No space between same–style paragraphs | ❌ No | ❌ No | ✅ Yes | |
Tabs | Alignment | ❌ No | ✅ Yes [4] | ✅ Yes [4] |
Leader | ❌ No | ✅ Yes [4] | ✅ Yes [4] | |
Borders and shading | Style | ❌ No | ❌ No | ✅ Yes |
Color | ❌ No | ❌ No | ✅ Yes | |
Width | ❌ No | ❌ No | ✅ Yes | |
Side | ❌ No | ❌ No | ✅ Yes | |
From text | ❌ No | ❌ No | ✅ Yes | |
Fill | ❌ No | ❌ No | ✅ Yes | |
Pattern style | ❌ No | ❌ No | ✅ Yes [5] | |
Pattern color | ❌ No | ❌ No | ✅ Yes | |
Language | Language | ❌ No | ✅ Yes (TextPartLanguage ) |
✅ Yes |
Do not check spelling | ❌ No | ❌ No | ❌ No | |
Frame | Text wrapping | ❌ No | ❌ No | ❌ No |
Size | ❌ No | ❌ No | ❌ No | |
Horizontal | ❌ No | ❌ No | ❌ No | |
Vertical | ❌ No | ❌ No | ❌ No | |
Bullet points and Numbering | General | ✅ Yes (List ) [7] |
✅ Yes (List ) [7] |
✅ Yes [7] |
- [1] Underline color is ignored.
- [2] Pasted as simple underline
- [3] Pasted as single strikethrough.
- [4] Tabs are non-interactive.
- [5] Not all Word border styles have CSS counterparts.
- [6] The overall density is preserved but the pattern details are lost.
- [7] Partial support.
# Microsoft Excel
Note: The name of each group in the table corresponds to the category in the Excel “Format cells” user interface. If a specific formatting is supported natively (without using the General HTML Support feature), a plugin name responsible for the formatting is provided in parentheses.
Group | Formatting | Paste from Office | Premium feature Paste from Office enhanced | |
---|---|---|---|---|
Native support | With General HTML Support | |||
Alignment | Horizontal alignment | ❌ No | ✅ Yes (TableCellProperties ) |
✅ Yes |
Vertical alignment | ❌ No | ✅ Yes (TableCellProperties ) |
✅ Yes | |
Indent | ❌ No | ✅ Yes (TableCellProperties ) |
✅ Yes | |
Orientation (angle) | ❌ No | ❌ No | ❌ No | |
Font | Family | ❌ No | ✅ Yes (FontFamily ) |
✅ Yes |
Style | ❌ No | ✅ Yes (Bold , Italic ) |
✅ Yes | |
Size | ❌ No | ✅ Yes (FontSize ) |
✅ Yes | |
Underline | ❌ No | ✅ Yes (Underline ) |
✅ Yes | |
Advanced underline (like double) | ❌ No | ❌ No | ❌ No | |
Color | ❌ No | ✅ Yes (FontColor ) |
✅ Yes | |
Strikethrough | ❌ No | ✅ Yes (Strikethrough ) |
✅ Yes | |
Superscript | ❌ No | ✅ Yes (Superscript ) |
✅ Yes | |
Subscript | ❌ No | ✅ Yes (Subscript ) |
✅ Yes | |
Border | Border color | ❌ No | ✅ Yes (TableCellProperties ) |
✅ Yes |
Border width | ❌ No | ✅ Yes (TableCellProperties ) |
✅ Yes | |
Border style | ❌ No | ✅ Yes [1] | ✅ Yes [1] | |
Borders across cell (diagonal) | ❌ No | ❌ No | ❌ No | |
Fill | Background | ❌ No | ✅ Yes (TableCellProperties ) |
✅ Yes |
Pattern color | ❌ No | ✅ Yes (TableCellProperties ) [2] |
✅ Yes [2] | |
Pattern style | ❌ No | ❌ No | ❌ No |
- [1] Not all Excel border styles have CSS counterparts.
- [2] It overrides the cell background.
# Support for other office applications
At the current stage, the focus of @ckeditor/ckeditor5-paste-from-office
and @ckeditor/ckeditor5-paste-from-office-enhanced
packages is on supporting content that comes from Microsoft Word, Microsoft Excel, and Google Docs. However, it does not mean that pasting from other similar applications (such as Microsoft PowerPoint) is not supported.
By default, CKEditor 5 will support pasting rich-text content from these applications, however, some styles and formatting may be lost, depending on the source application. Also, other minor bugs may appear.
You can find more information about compatibility with other applications in this ticket.
If you think that support for any of the applications needs improvements, add 👍 and comments in the following issues:
Feel free to open a new feature request for other similar applications, too!
# Installation
⚠️ New import paths
Starting with version 42.0.0, we changed the format of import paths. This guide uses the new, shorter format. Refer to the Packages in the legacy setup guide if you use an older version of CKEditor 5.
To add the paste from Office enhanced feature to your editor, you need to install basic, open-source paste from Office, paste from Office enhanced and General HTML Support plugins. The GeneralHtmlSupport
plugin is optional but recommended for optimal retention and accuracy of pasted styles. Learn more.
We highly recommend you also add other editor packages to get as much native support for pasted content as possible. You can learn more about editor features that work out–of–the–box with content pasted from Microsoft Office in a dedicated section. To install the recommended packages, execute the following command:
Add the PasteFromOffice
, PasteFromOfficeEnhanced
, and GeneralHtmlSupport
plugins to your plugin list as well as other editor features that support content pasted from Microsoft Office (Bold
, Italic
, FontColor
, Indent
, etc.):
import {
ClassicEditor,
PasteFromOffice,
GeneralHtmlSupport,
Alignment,
Bold,
Italic,
Underline,
Strikethrough,
Subscript,
Superscript,
FontColor,
FontBackgroundColor,
FontFamily,
FontSize,
Indent,
Table,
TableProperties,
TableCellProperties,
TextPartLanguage
} from 'ckeditor5';
import { PasteFromOfficeEnhanced } from 'ckeditor5-premium-features';
// Other imports...
ClassicEditor
.create( document.querySelector( '#editor' ), {
licenseKey: '<YOUR_LICENSE_KEY>',
plugins: [
// Load the open-source feature.
PasteFromOffice,
// Load the enhanced feature.
PasteFromOfficeEnhanced,
// Load the recommended General HTML Support feature.
GeneralHtmlSupport,
// Load other recommended editor features.
Alignment, Bold, Italic, Underline, Strikethrough, Subscript, Superscript,
FontColor, FontBackgroundColor, FontFamily, FontSize, Indent,
Table, TableProperties, TableCellProperties,
TextPartLanguage,
/* ... */
],
// See the "Configuration" section below to learn how to configure
// the editor for the best performance.
// ...
} )
.then( /* ... */ )
.catch( /* ... */ );
Finally, update the configuration.
# Activating the feature
To use this premium feature, you need to activate it with proper credentials. Refer to the License key and activation guide for details.
# Configuration
For more technical details, check the plugin configuration reference.
Paste from Office enhanced does not come with its own configuration. Still, we highly recommend to load and configure other editor features in a certain way for optimal retention and performance of pasted styles:
- General HTML Support – Enabling and configuring this feature will allow you to make the most of the paste from Office enhanced by retaining advanced formatting that would otherwise be rejected by core editor features. See the content compatibility table to learn more.
- Font size and family – Loading and configuring these features will ensure maximal compatibility of fonts in the pasted content.
The recommended configuration is as follows:
import {
ClassicEditor,
PasteFromOffice,
GeneralHtmlSupport,
Alignment,
Bold,
Italic,
Underline,
Strikethrough,
Subscript,
Superscript,
FontColor,
FontBackgroundColor,
FontFamily,
FontSize,
Indent,
Table,
TableProperties,
TableCellProperties,
TextPartLanguage
} from 'ckeditor5';
import { PasteFromOfficeEnhanced } from 'ckeditor5-premium-features';
// Other imports...
ClassicEditor
.create( document.querySelector( '#editor' ), {
licenseKey: '<YOUR_LICENSE_KEY>',
plugins: [
// Load the open-source feature.
PasteFromOffice,
// Load the enhanced feature.
PasteFromOfficeEnhanced,
// Load the recommended General HTML Support feature.
GeneralHtmlSupport,
// Load other recommended editor features.
Alignment, Bold, Italic, Underline, Strikethrough, Subscript, Superscript,
FontColor, FontBackgroundColor, FontFamily, FontSize, Indent,
Table, TableProperties, TableCellProperties,
TextPartLanguage,
/* ... */
],
// Configuration of the GeneralHtmlSupport plugin to allow extra content into the editor.
// This configuration will preserve styles and formatting normally unsupported by core editor features.
htmlSupport: {
allow: [
{
name: /^.*$/,
styles: true,
attributes: true,
classes: true
}
]
},
// Configuration of the FontFamily plugin.
fontFamily: {
// Allow all fonts from Microsoft Office documents
// including those that are unknown to CKEditor.
supportAllValues: true
},
// Configuration of the FontSize plugin.
fontSize: {
options: [
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22
],
// Allow all font sizes from Microsoft Office documents
// including those that are unknown to CKEditor.
supportAllValues: true
},
// Add UI buttons and dropdowns for extra editor features if you used the feature set
// from "Installation" section.
toolbar: [
// ...
'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
'|',
'alignment', 'outdent', 'indent',
'|',
'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor',
'|',
'insertTable',
'|',
'textPartLanguage',
// ...
],
// Add UI buttons and dropdowns for extra table features if you used the feature set
// from "Installation" section.
table: {
contentToolbar: [
'tableColumn', 'tableRow', 'mergeTableCells', '|', 'tableProperties', 'tableCellProperties'
]
},
// ...
} )
.then( /* ... */ )
.catch( /* ... */ );
# Known issues
- There is a known issue with cell widths being incorrect upon pasting from Microsoft Excel. Learn more.
- Headings pasted from Microsoft Word with a normal font weight configured in styles will be rendered using a bold font due to the default style sheets provided by the editor.
- A bold text pasted from Microsoft Excel may be occasionally displayed as normal for specific font faces.
- There is a known issue with font family, font size, and text part language values being displayed incorrectly in the CKEditor UI. Learn more
# Related features
CKEditor 5 supports a wider range of paste features, including:
- Paste from Office – Basic, open-source version of the paste from Office plugin.
- Paste from Google Docs – Paste content from Google Docs, maintaining the original formatting and structure.
- Paste plain text – Paste text without formatting that will inherit the style of the content it was pasted into.
- Import from Word – Convert Word files directly into HTML content. You can read more about the differences between the paste from Office and import from Word features in the dedicated comparison guide.
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.