From c28f4cf7065c2bd17c60b2a1c13d11a0e03eb49d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 20 May 2013 23:24:33 +0530 Subject: [PATCH] ... --- src/calibre/ebooks/docx/images.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/docx/images.py b/src/calibre/ebooks/docx/images.py index 583849728c..5cee6a595d 100644 --- a/src/calibre/ebooks/docx/images.py +++ b/src/calibre/ebooks/docx/images.py @@ -58,8 +58,12 @@ def get_image_margins(elem): return ans def get_hpos(anchor, page_width): - # TODO: Handle relativeFrom on positionH for ph in XPath('./wp:positionH')(anchor): + rp = ph.get('relativeFrom', None) + if rp == 'leftMargin': + return 0 + if rp == 'rightMargin': + return 1 for align in XPath('./wp:align')(ph): al = align.text if al == 'left':