Ckeditor5: Support for pasting content from Excel

Created on 26 Oct 2018  路  5Comments  路  Source: ckeditor/ckeditor5

It would be nice to have support for pasting content from Excel (for features which are already available in the editor - tables, basic text styling, highlights, etc).

First it should be verified what already works out-of-the-box. Next step is to add support (proper content transformations on paste) for missing features.

Add 馃憤 if you'd like to see this feature.

paste-from-office 2 feature

Most helpful comment

any news on this topic?
Paste from excel wihtout loosing formatting would be really good.

All 5 comments

I have checked how pasting from Excel works. Unfortunately, the editor throws an error on paste:

image

It seems there are some text nodes inside <tbody> which should not be there, breaking the table conversions:

image

After adding some quickfix, table copied from excel is pasted, however text/cells styling is missing. It happens because all of the styling is applied through CSS classes not by inline styling which can be easily converted by the editor. Pasting:

image

result in:

image

and the clipboard content on paste (inner HTML of <body> only) is:

<table border=0 cellpadding=0 cellspacing=0 width=435 style='border-collapse:
collapse;width:326pt'>
    <!--StartFragment-->
    <col width=112 style='mso-width-source:userset;mso-width-alt:3584;width:84pt'>
    <col width=159 style='mso-width-source:userset;mso-width-alt:5077;width:119pt'>
    <col width=164 style='mso-width-source:userset;mso-width-alt:5248;width:123pt'>
    <tr height=21 style='height:16.0pt'>
        <td height=21 class=xl70 width=112 style='height:16.0pt;width:84pt'>foo</td>
        <td class=xl68 width=159 style='width:119pt'>bar</td>
        <td class=xl69 width=164 style='width:123pt'>baz</td>
    </tr>
    <tr height=21 style='height:16.0pt'>
        <td height=21 class=xl65 style='height:16.0pt'>foo2</td>
        <td class=xl66>bar2</td>
        <td class=xl67>ba<font class="font5">z2</font></td>
    </tr>
    <!--EndFragment-->
</table>

It will require some mechanism for styles inlining so then editor could correctly mapped styles in each element.

It's enough for now if we preserve the structure table. So let's fix the crash first :D

It's enough for now if we preserve the structure table. So let's fix the crash first :D

馃 Should it be fixed in a way that we normalize pasted content or table converters should be fix to check node types more strictly? (I suppose the second approach may cover more cases in general) WDYT @Reinmar ?

BTW, this is a DUP of https://github.com/ckeditor/ckeditor5-table/issues/145.

I don't know the code there, but generally speaking, the editor should not crash when loading incorrect data. So the bug is not in the normalization if you can reproduce it without pasting.

any news on this topic?
Paste from excel wihtout loosing formatting would be really good.

Was this page helpful?
0 / 5 - 0 ratings