0

I am using the Python docx-mailmerge library to create a docx. But something is not like my hope.

My code:

from mailmerge import MailMerge

template='example.docx'
document_1 = MailMerge(template)
document_1.merge(misscount='>>> CSS Network Latencies\n    CRS-4678: Successful get misscount 30 for Cluster Synchronization Services.')
document_1.write('aaa.docx')

The ouptput in the docx is:

image description here

But my hope is:

image description here

I want the second line start with 4 space. What should i do?

TontonVelu
  • 471
  • 2
  • 8
  • 21
sky
  • 1
  • 1

2 Answers2

0

Have you tried to use '\t' after '\n' to tab the new line?

Genoxidus
  • 51
  • 1
  • 6
  • I already try it. But it doesn't work. The output is also like my first picture – sky May 28 '20 at 14:22
0

try using "\t" instead of 4 space. the effect is the same but this might work. like so:

'>>> CSS Network Latencies\n\tCRS-4678: Successful get misscount 30 for Cluster Synchronization Services.'

  • I already try it. But it doesn't work. The output is also like my first picture. – sky May 28 '20 at 14:20