Title: Splitting a run · Issue #519 · python-openxml/python-docx · GitHub
Open Graph Title: Splitting a run · Issue #519 · python-openxml/python-docx
X Title: Splitting a run · Issue #519 · python-openxml/python-docx
Description: I am trying to apply formatting to a document that already exists. I am trying to highlight text within the document, and I would like to preserve formatting around the changes I make. For example, highlight yellow all occurrences of "te...
Open Graph Description: I am trying to apply formatting to a document that already exists. I am trying to highlight text within the document, and I would like to preserve formatting around the changes I make. For example,...
X Description: I am trying to apply formatting to a document that already exists. I am trying to highlight text within the document, and I would like to preserve formatting around the changes I make. For example,...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/519
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Splitting a run","articleBody":"I am trying to apply formatting to a document that already exists. I am trying to highlight text within the document, and I would like to preserve formatting around the changes I make.\r\n\r\nFor example, highlight yellow all occurrences of \"test\" in the paragraph \"This is a test. This is only a test\"\r\nIn this example the paragraph is in one run to start, but will be in four runs after highlighting [\"This is a \", 'test\", \". This is only a \", \"test\"].\r\n\r\nIt is not immediately obvious how to accomplish this goal. There are no utility functions that I can find for copying the formatting of a run, or for splitting a run into multiple runs, or for adding a run to an arbitrary location in the paragraph. I am considering either constructing a whole new document paragraph by paragraph (grossly inefficient) or manually implementing run.split(start, end) and paragraph.addRunAt(n) functions. \r\n\r\nIs there a better way that I'm just missing? If I make the functions I described would they be useful to add to the package?","author":{"url":"https://github.com/aekoch","@type":"Person","name":"aekoch"},"datePublished":"2018-07-13T01:02:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/519/python-docx/issues/519"}
| 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:7046a0d9-8257-18a6-c815-a852c53c9135 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC1E:8A978:E14A54:138D65D:698F492D |
| html-safe-nonce | b181ef684b97a754e8a10435d34a823a729001d7165448d78c0a79ac76dee0de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzFFOjhBOTc4OkUxNEE1NDoxMzhENjVEOjY5OEY0OTJEIiwidmlzaXRvcl9pZCI6IjQ3MjUwMjI1NDQ5MTgxNjk5MDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 06de8acdd9a4f2bcda1c18cdd5fc415c5a68c08342b6c4c2059179b7958c25b9 |
| hovercard-subject-tag | issue:340846793 |
| 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/519/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8e950c148af3b7bfeb686609c51590589225000b593c311a6659a5c3a285e96/python-openxml/python-docx/issues/519 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8e950c148af3b7bfeb686609c51590589225000b593c311a6659a5c3a285e96/python-openxml/python-docx/issues/519 |
| og:image:alt | I am trying to apply formatting to a document that already exists. I am trying to highlight text within the document, and I would like to preserve formatting around the changes I make. For example,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aekoch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6102991c714c1a6a27d05fb4f96ea6ca87a6750b4f093b95cc57ed1b84b145a1 |
| 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 | 6a0e76b4dbdd86599b4b518abe0e57175194496e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width