Add Outline Levels 1 and 2 to Indexes at Levels 1/2 using Py
Posted: Mon Nov 07, 2016 6:18 pm
Hello All -
I am using LibreOffice 5.2 on Ubuntu and trying to see how to best solve the following issue using Python3.
I would like add Outline Levels 1/ 2 to four (4) Indexes I have. This is so the entry items in the 4 Indexes, when inserted at Level 3, show up under the Outline Levels 1/2 added at Levels 1/2 in those Indexes. Thus it would be useful to know where in the document the Index entries appear.
I have been able to do this manually to get the desired effect.
...
However, it would be better done programmatically through a macro and I am trying to see if I could best do it from Python3 as that is what I use mainly.
The following pseudocode is what I am generally contemplating:
- Check the 4 Indexes and if any item in those Indexes appear at Levels 1/2 then move them to Level 3, if they are not in Outline Levels 1/2.
- For each Outline Level 1/2 add to the 4 Indexes at Levels 1/2 as an Index item.
- My outline levels all end with semi-colon so I can do further checks before moving them or discarding them.
I am planning on using the XDocumentIndexes. I am assuming there is an interface to the Outline Index or some other interface to access the Outlines also.
If I could get please get some pointers on how to best use the API to access the structures inside the document I would much appreciate.
If there is a link in the forum or such you could connect me to, will be great. I have searched to no avail yet.
Also I assume the API is universal regardless of LibreOffice or OpenOffice?
Thank you for your help and suggestions.
Mono
I am using LibreOffice 5.2 on Ubuntu and trying to see how to best solve the following issue using Python3.
I would like add Outline Levels 1/ 2 to four (4) Indexes I have. This is so the entry items in the 4 Indexes, when inserted at Level 3, show up under the Outline Levels 1/2 added at Levels 1/2 in those Indexes. Thus it would be useful to know where in the document the Index entries appear.
I have been able to do this manually to get the desired effect.
...
However, it would be better done programmatically through a macro and I am trying to see if I could best do it from Python3 as that is what I use mainly.
The following pseudocode is what I am generally contemplating:
- Check the 4 Indexes and if any item in those Indexes appear at Levels 1/2 then move them to Level 3, if they are not in Outline Levels 1/2.
- For each Outline Level 1/2 add to the 4 Indexes at Levels 1/2 as an Index item.
- My outline levels all end with semi-colon so I can do further checks before moving them or discarding them.
I am planning on using the XDocumentIndexes. I am assuming there is an interface to the Outline Index or some other interface to access the Outlines also.
If I could get please get some pointers on how to best use the API to access the structures inside the document I would much appreciate.
If there is a link in the forum or such you could connect me to, will be great. I have searched to no avail yet.
Also I assume the API is universal regardless of LibreOffice or OpenOffice?
Thank you for your help and suggestions.
Mono