table alignment lost on conversion

Bug #1569583 reported by Miguel on 2016-04-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

I'm working on a Word file, then saving it as HTML filtered. I import it on Calibre (version 2.54, on Windows 10), and convert the file to AZW3. However, the centralized table now lacks the "align:center" property, defaulting to left alignment.

If I manually edit the converted book adding "align:center" to the table, it works correctly. I'm uploading a small HTML sample, so it's easier to reproduce the problem, since it contains a single centralized table and two paragraphs.

Miguel (nyarlathotep) wrote :
Miguel (nyarlathotep) wrote :

Attaching the AZW3 output.

align=center is deprecated, even in HTML 4, and completely disallowed in HTML 5.
https://www.w3.org/TR/html4/present/graphics.html#h-15.1.2

You really should not be using MS word HTML output, it is awful. Convert
the docx file from word directly instead. ALternately, replace
align=center with style="text-align:center" in the HTML and you will be
fine.

 status invalid

Changed in calibre:
status: New → Invalid
Kovid Goyal (kovid) wrote :

Actually since this is for a table, setting text-align wont work, you
will need to set margin-left: auto and margin-right:auto on the table.

Kovid Goyal (kovid) wrote :

Actually, I think I'll add some code to calibre to detect this
particular broken construct and add the margin declarations for child
tables automatically.

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Miguel (nyarlathotep) wrote :

Thanks for the explanations, Kovid. Indeed, setting the margins to "Auto" solved the issue. I'm looking forward to the new version.

Anyway, I'll see if I can change my workflow and start using the docx as my source. I do a lot of modifications on the html, though, so I'll have to see if they're still feasible on the docx.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers