I currently have a paragraph as a header that is Pt44
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'