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', etc.) ;
In 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 that the following need to first be obtained (let me know what's missing!)
(i) the abstract numbering format
(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
(iii) the index of the current paragraph within the immediate nested list ('(a)' index 0 , '(b)' index 1 etc).
(iv) overrides?
if preferred, the get_listnum() method could return a tuple of (numText, format, level, index) --> ("9.1", '%1.%2' , 2, 0)
For example,
when open in microsoft word the docx appears as below:
SECTION 5
INTEREST PAYMENTS
9. INTEREST
9.1 Calculation of interest
The rate of interest on each Loan for each period is the percentage rate per annum which is the aggregate of the applicable:
(a) margin; and
(b) LIBOR.
currently, (paragraph.text, paragraph.style) yields:
SECTION 5 INTEREST PAYMENTS , _ParagraphStyle("Normal")
INTEREST , _ParagraphStyle("Style1")
Calculation of interest , _ParagraphStyle("Style2")
The rate of interest on each Loan for each period is the percentage rate per annum which is the aggregate of the applicable:
margin; and , _ParagraphStyle("Style3")
LIBOR. _ParagraphStyle("Style3")
paragraph.listnum_text() would yield:
''
'9.'
'9.1'
''
'(a)'
'(b)'
etc.
Thoughts, 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...)
Still, I feel like if you solved this you could basically circumvent microsoft word entirely!