Opened 4 years ago

Last modified 4 years ago

#16811 closed Bug

No table align when pasted from Word — at Version 2

Reported by: Marek Lewandowski Owned by:
Priority: Nice to have (we want to work on it) Milestone: CKEditor 4.7.0
Component: General Version: 4.6.0
Keywords: Cc:

Description (last modified by Marek Lewandowski)

Steps to reproduce

  1. Open attached Table_alignment.docx document in Word.
  2. Copy it's content.
  3. Paste into a full featured editor.

Expected result

Tables are aligned as in the docx document.

Actual result

Alignments are stripped.

More details

It looks in Word pretty much like this:

https://i.imgur.com/OdLhLi5.png

The problem is that Word generates following markup:

<div align=right>

<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 style='(...)'>
 <tr style='(...)'>
 	(...)
 </tr>
</table>

</div>

Which displays it correctly, but uses deprecated align attribute.

We have a style transformation in core which transforms any align into float CSS prop, which is fine for elements like table, img, iframe, but it's wrong for div and p. Becasue for div and p it defines the alignment of content elements within this element.

It's also worth to remember that align is a little more aggresive than text-align CSS prop, as it affects anything, whereas for text-align you need to apply margin: x auto for block-alike elements, otherwise they won't be aligned.

Change History (3)

Changed 4 years ago by Marek Lewandowski

Attachment: Table_alignment.docx added

comment:1 Changed 4 years ago by Marek Lewandowski

Status: newconfirmed

comment:2 Changed 4 years ago by Marek Lewandowski

Description: modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy