[Python] New lines/tabulators turn into spaces in generated document

Discussão em 'Python' iniciado por Stack, Novembro 23, 2024.

  1. Stack

    Stack Membro Participativo

    I have problem with \n and \t tags. When I am opening a generated .docx in OpenOffice everything looks fine, but when I open the same document in Microsoft Word I just get the last two tabulators in section "Surname" and spaces instead of newlines/tabulators in other sections. What is wrong?

    p = document.add_paragraph('Simple paragraph')
    p.add_run('Name:\t\t' + name).bold = True
    p.add_run('\n\nSurname:\t\t' + surname)

    Continue reading...

Compartilhe esta Página