from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Pt
from docx.shared import Length
from docx.shared import RGBColor
from docx.enum.style import WD_STYLE

document = Document()

#document = Document('verif_plan_template.docx')

document.add_heading('XXXXX Digital Verification Test Plan', 0)

# define style
#styles = document.styles
#style = styles[WD_STYLE.BODY_TEXT]

p = document.add_paragraph('A plain paragraph having some ')
# insére un espace entre le heading et le paragraphe
p.paragraph_format.space_before = Pt(78)
p.add_run('bold').bold = True
p.add_run(' and some ')
p.add_run('italic.').italic = True
p.add_run(" and some fdf lkjdfksqjfk lsgjsdkgskg fgqgkjqglkqsj  fglkjglkqjgjfg lkjgkqlgjqgj  ")
p.alignment = WD_ALIGN_PARAGRAPH.JUSTIFY


p = document.add_paragraph('Suite du programme A plain paragraph having some ')
p.add_run('bold').bold = True
p.add_run(' and some ')
p.add_run('italic.').italic = True
p.add_run(" and some fdf lkjdfksqjfk lsgjsdkgskg fgqgkjqglkqsj  fglkjglkqjgjfg lkjgkqlgjqgj  ")
p.alignment = WD_ALIGN_PARAGRAPH.JUSTIFY

p.paragraph_format.space_before = Pt(38)



p = document.add_paragraph('')
p.add_run('salit').underline = True
p.add_run('pipotron').bold = True


p = document.add_paragraph('')
p = document.add_paragraph(style = 'ListParagraph', text = "1.")
p = document.add_paragraph(style = 'ListParagraph', text = "1.")
p = document.add_paragraph(style = 'ListParagraph', text = "1.")
p = document.add_paragraph(style = 'ListParagraph', text = "1.")



#p = document.add_paragraph(style = "ListNumber" , text = "blabla")

p = document.add_paragraph('')
#p.add_run()
p = document.add_paragraph(style = 'ListNumber', text = "AAAA.")
p = document.add_paragraph(style = 'ListNumber1', text = "AAAA.")
#p = document.add_paragraph(style = 'ListNumber2', text = "AAAA.")
#p = document.add_paragraph("blabla", style="ListNumber2")
#document.add_paragraph("blabla", style="ListNumber3")
#document.add_paragraph("blabla", style="ListNumber")

document.add_heading('Headline No. 1', level=1)

#document.add_paragraph("blabla", style="ListNumber")

document.add_paragraph('Test No. 1')
document.add_heading('Heading No. 2', level=1)
document.add_paragraph('Test No. 2')

# add page
document.add_page_break()

document.save('toto.docx')
