Title: How do I add style to images? · Issue #1510 · python-openxml/python-docx · GitHub
Open Graph Title: How do I add style to images? · Issue #1510 · python-openxml/python-docx
X Title: How do I add style to images? · Issue #1510 · python-openxml/python-docx
Description: Basically, I want to achieve "Format Picture" in Office Word, where you right click an element in a .docx file and attach solid line (ideally, I want to also manually set color, width, transparency, etc) border to the image import docx f...
Open Graph Description: Basically, I want to achieve "Format Picture" in Office Word, where you right click an element in a .docx file and attach solid line (ideally, I want to also manually set color, width, transparency...
X Description: Basically, I want to achieve "Format Picture" in Office Word, where you right click an element in a .docx file and attach solid line (ideally, I want to also manually set color, width, tr...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/1510
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"How do I add style to images?","articleBody":"Basically, I want to achieve \"Format Picture\" in Office Word, where you right click an element in a .docx file and attach solid line (ideally, I want to also manually set color, width, transparency, etc) border to the image\n\n```\nimport docx\nfrom docx import Document\nfrom docx.oxml import OxmlElement\nfrom docx.oxml.ns import qn\ndoc = Document(p)\nfor element in doc.element.body:\n if hasattr(element, 'inner_content_elements'):\n for ele in element.inner_content_elements:\n for i in ele.inner_content_items:\n outline = OxmlElement('a:ln', {'w': '9525'})\n solid_fill = OxmlElement('a:solidFill')\n scheme_color = OxmlElement('a:schemeClr', {'val': 'green'})\n solid_fill.append(scheme_color)\n outline.append(solid_fill)\n i.append(outline)\n```\n\nAbove is the code I tried, which gives no error, but the result file is broken, as it says when I tried to open the file: \n\n```\nWord experienced an error trying to open the file. \nTry these suggestions.\n* Check the file permissions for the document or drive.\n* Make sure there is sufficient free memory and disk space.\n* Open the file with the Text Recovery converter.\n(Path/to/the/file)\n```\n\nAny suggestions?","author":{"url":"https://github.com/fyy623","@type":"Person","name":"fyy623"},"datePublished":"2025-07-30T11:00:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1510/python-docx/issues/1510"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7025c58d-5b43-aefd-0f38-10a9194fdc06 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E49E:63833:CEFF92:11003D1:696B608C |
| html-safe-nonce | 898a4fe8039d6e6452bef168fc3cf2d93cff05386d36fe09003309c4b069d45b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDlFOjYzODMzOkNFRkY5MjoxMTAwM0QxOjY5NkI2MDhDIiwidmlzaXRvcl9pZCI6IjQzODM5MDc4NDU2MDY0MzI5MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6724ba6b11e8833bffaa726e7e8c28a6bdc47666e1b99bb697578da56b88e9ec |
| hovercard-subject-tag | issue:3276585516 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-openxml/python-docx/1510/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a67fbf9adfd0621795c438d2a40867553e41f9a68ea9ed79df92e5f9acd00ea/python-openxml/python-docx/issues/1510 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a67fbf9adfd0621795c438d2a40867553e41f9a68ea9ed79df92e5f9acd00ea/python-openxml/python-docx/issues/1510 |
| og:image:alt | Basically, I want to achieve "Format Picture" in Office Word, where you right click an element in a .docx file and attach solid line (ideally, I want to also manually set color, width, transparency... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | fyy623 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python-openxml/python-docx git https://github.com/python-openxml/python-docx.git |
| octolytics-dimension-user_id | 3403760 |
| octolytics-dimension-user_login | python-openxml |
| octolytics-dimension-repository_id | 13592924 |
| octolytics-dimension-repository_nwo | python-openxml/python-docx |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 13592924 |
| octolytics-dimension-repository_network_root_nwo | python-openxml/python-docx |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width