Reputation: 3802
I have this code:
for para in doc.paragraphs:
if para.style.name != 'Heading 1':
#Change outline level of para to Body Text
I'd like to change outline level of para to 'Body Text'. I must create an index in a huge docx document. I want that only paragraph with 'Heading 1' will be in index so I think I must set other paragraphs outline level Body Text or in a way to not appear in index.
Upvotes: 1
Views: 756
Reputation: 28953
The outline-level for headings is an attribute of the style, so changing the style to Body Text
should do what you're looking for:
paragraph.style = document.styles['Body Text']
Upvotes: 1