-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.py
More file actions
72 lines (59 loc) · 2 KB
/
template.py
File metadata and controls
72 lines (59 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import docx
from docx.shared import Pt
# Création d'un nouveau document Word
template = docx.Document()
# Ajout d'un titre
template.add_heading('Contrat de Bail', level=1)
# Section DUREE
template.add_heading('DUREE', level=2)
# Tableau pour la section DUREE
table_duree = template.add_table(rows=1, cols=3)
table_duree.style = 'Table Grid'
# En-têtes du tableau
hdr_cells = table_duree.rows[0].cells
hdr_cells[0].text = 'Élément'
hdr_cells[1].text = 'Option 1'
hdr_cells[2].text = 'Option 2'
# Ajout des lignes pour chaque élément
elements_duree = [
("Date de signature", "", ""),
("Loi Pinet (loi n°2014: 626 du 18 juin 2014)", "", ""),
("Date de prise d’effet", "", ""),
("Durée du Bail", "", ""),
("Terme contractuel du Bail", "", ""),
("Période ferme", "", ""),
("Prochaine faculté de sortie", "", ""),
("Préavis minimum à respecter", '', ""),
("Clause spécifique relative à la durée du Bail renouvelé", "", "")
]
for elem in elements_duree:
row_cells = table_duree.add_row().cells
row_cells[0].text = elem[0]
row_cells[1].text = elem[1]
row_cells[2].text = elem[2]
# Section LOYER
template.add_heading('LOYER', level=2)
# Tableau pour la section LOYER
table_loyer = template.add_table(rows=1, cols=3)
table_loyer.style = 'Table Grid'
# En-têtes du tableau
hdr_cells = table_loyer.rows[0].cells
hdr_cells[0].text = 'Élément'
hdr_cells[1].text = 'Option 1'
hdr_cells[2].text = 'Option 2'
# Ajout des lignes pour chaque élément
elements_loyer = [
("Mode de calcul du loyer", "", ""),
("", "", ""),
("Loyer annuel (NT HC)", "Initial", "En cours"),
("", "", ""),
("", "", "Source : "),
("Paiement trimestriellement et d'avance", "", "")
]
for elem in elements_loyer:
row_cells = table_loyer.add_row().cells
row_cells[0].text = elem[0]
row_cells[1].text = elem[1]
row_cells[2].text = elem[2]
# Sauvegarde du document
template.save('template.docx')