table alignment lost on conversion

Bug #1569583 reported by Miguel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
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.

Revision history for this message
Miguel (nyarlathotep) wrote :
Revision history for this message
Miguel (nyarlathotep) wrote :

Attaching the AZW3 output.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1569583

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
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

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
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.