Skip to content

Commit 9d26e2b

Browse files
committed
ole: add p:oleObj.imgW and imgH
1 parent a284dee commit 9d26e2b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pptx/oxml/shapes/graphfrm.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def new_ole_object_graphicFrame(
208208
"""
209209
return parse_xml(
210210
cls._graphicFrame_xml_for_ole_object(
211-
id_, name, x, y, cx, cy, ole_object_rId, progId, icon_rId
211+
id_, name, x, y, cx, cy, ole_object_rId, progId, icon_rId, imgW, imgH
212212
)
213213
)
214214

@@ -247,7 +247,7 @@ def _graphicFrame_tmpl(cls):
247247

248248
@classmethod
249249
def _graphicFrame_xml_for_ole_object(
250-
cls, id_, name, x, y, cx, cy, ole_object_rId, progId, icon_rId
250+
cls, id_, name, x, y, cx, cy, ole_object_rId, progId, icon_rId, imgW, imgH
251251
):
252252
"""str XML for <a:graphic> element of an embedded OLE-object shape."""
253253
return (
@@ -268,8 +268,8 @@ def _graphicFrame_xml_for_ole_object(
268268
' uri="http://schemas.openxmlformats.org/presentationml/2006/ole">\n'
269269
' <p:oleObj showAsIcon="1"'
270270
' r:id="{ole_object_rId}"'
271-
' imgW="965200"'
272-
' imgH="609600"'
271+
' imgW="{imgW}"'
272+
' imgH="{imgH}"'
273273
' progId="{progId}">\n'
274274
" <p:embed/>\n"
275275
" <p:pic>\n"
@@ -309,6 +309,8 @@ def _graphicFrame_xml_for_ole_object(
309309
ole_object_rId=ole_object_rId,
310310
progId=progId,
311311
icon_rId=icon_rId,
312+
imgW=imgW,
313+
imgH=imgH,
312314
)
313315

314316

tests/shapes/test_shapetree.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2183,7 +2183,7 @@ def it_creates_the_graphicFrame_element(self, request):
21832183
" <a:graphic>\n"
21842184
" <a:graphicData "
21852185
'uri="http://schemas.openxmlformats.org/presentationml/2006/ole">\n'
2186-
' <p:oleObj showAsIcon="1" r:id="rId42" imgW="965200" imgH="609600" '
2186+
' <p:oleObj showAsIcon="1" r:id="rId42" imgW="457200" imgH="685800" '
21872187
'progId="Excel.Sheet.42">\n'
21882188
" <p:embed/>\n"
21892189
" <p:pic>\n"

0 commit comments

Comments
 (0)