I currently have a paragraph as a header that is Pt48 in size and I want to create a new line break using add_break() which works perfectly fine but it inherits the top paragraph character size. Is there a way to specify the new line break character size. I've look at the documentation and I cannot find anything that can do this. Line Break Reference | Working with Text Refrence
Some code for reference
document = Document()
initiate_all_styles(document)
invoice_header = document.add_paragraph(style='invoice')
invoice_header_run = invoice_header.add_run('INVOICE')
invoice_header_run.bold = True
invoice_header_run.add_break()
document.save('invoice.docx')
Styles code
def initiate_all_styles(document):
initiate_invoice_style(document)
#other methods for styles located here
def initiate_invoice_style(document):
font_styles = document.styles
font_charstyle = font_styles.add_style('invoice', WD_STYLE_TYPE.PARAGRAPH)
font_charstyle.font.color.rgb = RGBColor.from_string(MAIN_COLOR)
font_object = font_charstyle.font
font_object.size = Pt(48)
font_object.name = 'Arial'
Edit:
My current solution for this is to create an invisible paragraph with a character that matched the background colour and set the size to my desired spacing Pt(10).
This is definitely not a great solution and more of a hack but it works. This also takes a extra couple lines of code rather then potentially adding 1 and maintaining it also pain in the butt.
invisible_character = document.add_paragraph('-', style='invisible')
invisible_character.paragraph_format.line_spacing = ONE_DOT_ZERO_LINE_SPACING
invisible_character.paragraph_format.space_after = ZERO_SPACE_AFTER