如何在ckeditor中粘贴excel表?

时间:2014-09-10 10:09:42

标签: javascript ckeditor

如何在ckeditor中粘贴excel表?

demo我可以粘贴格式化的表格,但在我的情况下,表格被粘贴为纯文本。我相信它与ckeditor的配置有关但却无法找到它。 我应该安装一些插件吗?

我在config.js

中试过这个
CKEDITOR.editorConfig = function(config) {
    config.pasteFromWordPromptCleanup = false;
    config.pasteFromWordRemoveFontStyles = false;
    config.forcePasteAsPlainText = false;
    config.ignoreEmptyParagraph = false;
    config.removeFormatAttributes = false;
};

提前致谢。

2 个答案:

答案 0 :(得分:0)

几个小时后,我找到了一个解决方案。似乎所有的html都被删除了,而不仅仅是表格。

我将此添加到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

答案 1 :(得分:0)

配置文件的以下设置对我有用

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; 
}