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: patch-diff.githubusercontent.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:fb98d06b-3b02-49a8-d24b-76476cbbf5f1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9556:DBDF5:19FC0B:22CB68:697152E6 |
| html-safe-nonce | 6bb6a6b38aab0b1a323c89260f2555174fc9bfda4fa9d9ebe2fad59e9482d918 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTU2OkRCREY1OjE5RkMwQjoyMkNCNjg6Njk3MTUyRTYiLCJ2aXNpdG9yX2lkIjoiODIxMDA0MTQ3MjI2MjY4OTUxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9758def4455376392d5bd0469c2c8cc2ba9cdd800a6ca0a5ad0eb007cf901e40 |
| 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 | fd5876ec68f4a61d42f4010f6d1b2764d8ae314777de44028a7708a1d7bac1b5 |
| 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 | 8f48ed2345879fb640360c3a24f1d1780c3ed3cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width