Title: Feature Request: Paragraph.get_listnum() · Issue #471 · python-openxml/python-docx · GitHub
Open Graph Title: Feature Request: Paragraph.get_listnum() · Issue #471 · python-openxml/python-docx
X Title: Feature Request: Paragraph.get_listnum() · Issue #471 · python-openxml/python-docx
Description: following from #180 #25 #217 ... especially #25 Proposed Feature: Paragraph method computing/yielding a string of the paragraph number/heading as it would appear in the open microsoft word document (e.g. '9.1', '(a)', '(i)', 'Article III...
Open Graph Description: following from #180 #25 #217 ... especially #25 Proposed Feature: Paragraph method computing/yielding a string of the paragraph number/heading as it would appear in the open microsoft word document...
X Description: following from #180 #25 #217 ... especially #25 Proposed Feature: Paragraph method computing/yielding a string of the paragraph number/heading as it would appear in the open microsoft word document...
Opengraph URL: https://github.com/python-openxml/python-docx/issues/471
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request: Paragraph.get_listnum()","articleBody":"following from #180 #25 #217 ... especially #25 \r\n\r\nProposed Feature: Paragraph method computing/yielding a string of the paragraph number/heading as it would appear in the open microsoft word document (e.g. '9.1', '(a)', '(i)', 'Article III', etc.) ; \r\n\r\nIn obtaining the above, assuming (based on very preliminary review of this helpful article: [https://msdn.microsoft.com/en-us/library/office/ee922775(v=office.14).aspx](https://msdn.microsoft.com/en-us/library/office/ee922775(v=office.14).aspx) that the following need to first be obtained (let me know what's missing!)\r\n(i) the abstract numbering format\r\n(ii) the level of current paragraph within numbered list if nested e.g. ('9.' in example below would be level1 and '9.1' would be level2\r\n(iii) the index of the current paragraph within the immediate nested list ('(a)' index 0 , '(b)' index 1 etc). \r\n(iv) overrides? \r\n\r\nif preferred, the get_listnum() method could return a tuple of (numText, format, level, index) --\u003e (\"9.1\", '%1.%2' , 2, 0)\r\n\r\n\r\nFor example, \r\n\r\n###### \u003ci\u003e when open in microsoft word the docx appears as below:\u003c/i\u003e \r\n\r\n### \u003chr\u003e\r\n### SECTION 5\u003c/b\u003e \u003c/br\u003e INTEREST PAYMENTS\u003c/div\u003e\r\n\r\n### 9. INTEREST\r\n\r\n#### 9.1 Calculation of interest\r\n\r\nThe rate of interest on each Loan for each period is the percentage rate per annum which is the aggregate of the applicable:\r\n\r\n##### (a) margin; and\r\n\r\n##### (b) LIBOR.\r\n### \u003chr\u003e\r\n\r\n\r\n###### \u003ci\u003e currently, (paragraph.text, paragraph.style) yields:\u003c/i\u003e \r\nSECTION 5 INTEREST PAYMENTS , _ParagraphStyle(\"Normal\")\r\n INTEREST , _ParagraphStyle(\"Style1\")\r\n Calculation of interest , _ParagraphStyle(\"Style2\")\r\nThe rate of interest on each Loan for each period is the percentage rate per annum which is the aggregate of the applicable:\r\nmargin; and , _ParagraphStyle(\"Style3\")\r\nLIBOR. _ParagraphStyle(\"Style3\")\r\n\r\nparagraph.listnum_text() would yield:\r\n''\r\n'9.'\r\n'9.1'\r\n''\r\n'(a)'\r\n'(b)' \r\netc.\r\n\r\nThoughts, comments? Interest in a concerted effort to finally solve this issue and add it to the library? I realise a lot of people have already spent significant time on this and that there are a bunch of pitfalls I'm not considering (if it were that easy, we'd have the feature already...)\r\n\r\nStill, I feel like if you solved this you could basically circumvent microsoft word entirely! \r\n\r\n","author":{"url":"https://github.com/nikeqiang","@type":"Person","name":"nikeqiang"},"datePublished":"2018-02-07T13:52:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/471/python-docx/issues/471"}
| 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:54e6b06b-ac16-6bc5-5f41-a850eb0092f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE78:28003F:24709A:341751:696FA268 |
| html-safe-nonce | 13c02d8e957f733994e403670f91e45e4b67b6c03bb27fdef45fa840f99576c1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTc4OjI4MDAzRjoyNDcwOUE6MzQxNzUxOjY5NkZBMjY4IiwidmlzaXRvcl9pZCI6IjIzNDc0MDE5ODIxMjIxMDc0OTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a0b69b38ad091fd3f80049971565058d4f347feb2b3c56edccda30ce1d71fe2d |
| hovercard-subject-tag | issue:295145111 |
| 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/471/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eb4b74c81a6eb293820301bcc623847e758ec7caaadd358eaf6392a7021b9d3d/python-openxml/python-docx/issues/471 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eb4b74c81a6eb293820301bcc623847e758ec7caaadd358eaf6392a7021b9d3d/python-openxml/python-docx/issues/471 |
| og:image:alt | following from #180 #25 #217 ... especially #25 Proposed Feature: Paragraph method computing/yielding a string of the paragraph number/heading as it would appear in the open microsoft word document... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nikeqiang |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0ca8d8c65612640b9a1a588b3eed68222ca723ed2d028b18fe81b28936d535eb |
| 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 | 95f60616ce2765d1114fe6da4af405a58c6d26d2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width