-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how_to_apply_a_style_to_a_paragraph.py simply duplicates paragraphs with new style. #21
Comments
Hi, And there is some bug: if neither regex or offset are provided, nothing happens (it should be at least raise an error) |
I don't need to apply a style to specific words, I need to apply the style to the paragraph. It's just simple clean up work. So the regex is pretty useless to me. Instead I worked around this by adding:
Since you're reading this thread though... Thank you so much for creating this! |
Maybe Paragraph.set_span("syle_name", offset=0), that should apply to whole content of the paragraph. |
No joy. I've tried "Text_Body", "text_body", "Text Body", "text body" with offset=0 but once the document is generated, there's no change the the paragraphs. for selectedParagraph in body.get_paragraphs():
# Work on the content inside the paragraph
paragraphContent = selectedParagraph.text_recursive
selectedParagraph.set_span("Text_Body", offset=0) I can't use |
so I tried the append route (as described in the recipes) but that just adds an extra element. I hunted down what seems to be the correct way to do it, which is 'set_span' since I'm iterating through the paragraphs but... no joy.
Still stays as "Default Paragraph Style".
What gives?
Additional
For applying a style to a paragraph the recipes offer:
body.append(Paragraph("some text", style="Text Body"))
However, append does exactly what it is designed to do and basically copies the paragraph.
The text was updated successfully, but these errors were encountered: