From 2fb3d62533002d59bb524abc4044dff82653ed67 Mon Sep 17 00:00:00 2001 From: SeaStar Deng <37767638+DSeaStar@users.noreply.github.com> Date: Fri, 14 Aug 2026 20:48:00 +0000 Subject: [PATCH] Write connector EMU coordinates as integers. OOXML a:off/a:ext attributes are integers. add_connector() often receives floats (for example shape.height / 2), which were interpolated into XML and produced files PowerPoint and Google Slides reject. --- src/pptx/oxml/shapes/connector.py | 4 ++-- tests/shapes/test_shapetree.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pptx/oxml/shapes/connector.py b/src/pptx/oxml/shapes/connector.py index 91261f780..3cd19f111 100644 --- a/src/pptx/oxml/shapes/connector.py +++ b/src/pptx/oxml/shapes/connector.py @@ -58,8 +58,8 @@ def new_cxnSp( f" \n" f" \n" f" \n" - f' \n' - f' \n' + f' \n' + f' \n' f" \n" f' \n' f" \n" diff --git a/tests/shapes/test_shapetree.py b/tests/shapes/test_shapetree.py index 3cf1ab225..e3e107e29 100644 --- a/tests/shapes/test_shapetree.py +++ b/tests/shapes/test_shapetree.py @@ -523,6 +523,14 @@ def add_cht_gr_frm_fixture(self): 3, "p:spPr/(a:xfrm{flipH=1,flipV=1}/(a:off{x=2,y=3},a:ext{cx=7,cy=5})", ), + # float EMUs (e.g. shape.height / 2) must become integer XML attrs + ( + 1.5, + 2.5, + 3.7, + 5.2, + "p:spPr/(a:xfrm/(a:off{x=1,y=2},a:ext{cx=2,cy=2})", + ), ] ) def add_cxnSp_fixture(self, request):