python-openxml / python-docx

Create and modify Word documents with Python
MIT License
4.63k stars 1.13k forks source link

Need a way to get paragraph outline level #485

Open dluciv opened 6 years ago

dluciv commented 6 years ago

Hi! First, thank you for your great library!

Some documents miss heading styles but still keep the sectining. Moreover, styles can be named in arbitrary manner, so there can be no chance to get document outline for some particular document.

Can we please provide a way to get outline elevel of a paragraph? It looks like Word stores it using <w:outlineLvl w:val="...">.

It is mentioned once in the code, but I see no highlevel way to get it out.

bighaidao commented 6 years ago

@dluciv hi ,do you have way to get this now ? w:outlineLvl

dluciv commented 6 years ago

Haven't actually checked after the March. Will check in few days, thank you!

bighaidao commented 6 years ago

I switch to docx4j . If you have any good news, pls update in there to help others . Thank you

flutefreak7 commented 4 years ago

+1 to this issue. I'd like to be able to generate structured documents with content assigned to appropriate outline levels and it doesn't appear that I can do that currently with python-docx outside of just using the header levels.

If I want to add a bulletted list and set its paragraph as outline level 3, though, it seems I can't do that currently.