问题
How to paste excel table in ckeditor ?
In the demo I'm available to paste formatted table but in my case the table is pasted as plain text. I believe it is something to do with the config of ckeditor but couldn't find it. Should I install some plugins ?
I've tried this in config.js
CKEDITOR.editorConfig = function(config) {
config.pasteFromWordPromptCleanup = false;
config.pasteFromWordRemoveFontStyles = false;
config.forcePasteAsPlainText = false;
config.ignoreEmptyParagraph = false;
config.removeFormatAttributes = false;
};
Thanks in advance.
回答1:
After several hours I found a solution. it seems that all html was removed, not only tables.
I added this to the config.js :
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
CKEDITOR.config.forcePasteAsPlainText = false; // default so content won't be manipulated on load
CKEDITOR.config.basicEntities = true;
CKEDITOR.config.entities = true;
CKEDITOR.config.entities_latin = false;
CKEDITOR.config.entities_greek = false;
CKEDITOR.config.entities_processNumerical = false;
CKEDITOR.config.fillEmptyBlocks = function (element) {
return true; // DON'T DO ANYTHING!!!!!
};
Source
回答2:
Following settings to the config file has worked for me
config.removeButtons = 'Underline,Subscript,Superscript';
config.ignoreEmptyParagraph = false;
config.pasteFromWordPromptCleanup = false;
config.pasteFromWordRemoveFontStyles = false;
config.pasteFromWordRemoveStyles = false;
CKEDITOR.config.enterMode = CKEDITOR.ENTER_BR;
config.removeFormatAttributes = false;
CKEDITOR.config.forcePasteAsPlainText = false;
CKEDITOR.config.basicEntities = true;
CKEDITOR.config.entities = true;
CKEDITOR.config.entities_latin = false;
CKEDITOR.config.entities_greek = false;
CKEDITOR.config.entities_processNumerical = false;
CKEDITOR.config.fillEmptyBlocks = function (element) {
return true;
}
来源:https://stackoverflow.com/questions/25762705/how-to-paste-excel-table-in-ckeditor