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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
| 'Titre tableau A
oInfo = docWord.Content.Paragraphs.Add(docWord.Bookmarks.Item("\endofdoc").Range)
oInfo.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft
oInfo.Range.Font.Size = 12
oInfo.Range.Font.Bold = False
oInfo.Range.Text = "Tableau A : "
'pos1 = docWord.Range.Start
pos2 = oInfo.Range.End - 1
oInfo.Range.InsertAfter(Format(Now,"dd/MM/yyyy"))
oInfo.Format.SpaceAfter = 12
oInfo.Range.InsertParagraphAfter()
docWord.Range(pos1, pos2).Font.Bold = True
pos1 = oInfo.Range.End - 1
'Table A
nbligne = 0
For Each ligne In TableA.Items
nbligne += 1
Next
If nbligne <> 0 Then
oTable = docWord.Tables.Add(docWord.Bookmarks.Item("\endofdoc").Range, nbligne + 1, nbcolonne)
oTable.Range.ParagraphFormat.SpaceAfter = 6
oTable.Range.Font.Size = 12
oTable.Range.Font.Bold = False
nbligne = 0
'Entête
oTable.Cell(1, 1).Range.Text = "ID"
oTable.Cell(1, 2).Range.Text = "Nom"
oTable.Cell(1, 3).Range.Text = "Valeur"
oTable.Cell(1, 4).Range.Text = "Unité"
For Each ligne In TableA.Items
For c = 0 To nbcolonne - 1
oTable.Cell(nbligne + 2, c + 1).Range.Text = ligne.SubItems(c).Text
Next
nbligne += 1
Next
oTable.Rows.Item(1).Range.Font.Bold = True
oTable.Rows.Item(1).Range.Font.Italic = True
End If
oInfo.Range.Text = ""
oInfo.Range.InsertParagraphAfter()
'Titre tableau B
oInfo = docWord.Content.Paragraphs.Add(docWord.Bookmarks.Item("\endofdoc").Range)
oInfo.Range.ParagraphFormat.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft
oInfo.Range.Font.Size = 12
oInfo.Range.Font.Bold = False
oInfo.Range.Text = "Tableau B : "
pos2 = oInfo.Range.End - 1
oInfo.Range.InsertAfter(Format(Now,"dd/MM/yyyy"))
oInfo.Format.SpaceAfter = 12
oInfo.Range.InsertParagraphAfter()
docWord.Range(pos1, pos2).Font.Bold = True
pos1 = oInfo.Range.End - 1
'table B
nbligne = 0
For Each ligne In TableB.Items
nbligne += 1
Next
If nbligne <> 0 Then
oTable = docWord.Tables.Add(docWord.Bookmarks.Item("\endofdoc").Range, nbligne + 1, nbcolonne)
oTable.Range.ParagraphFormat.SpaceAfter = 6
oTable.Range.Font.Size = 12
oTable.Range.Font.Bold = False
nbligne = 0
'Entête
oTable.Cell(1, 1).Range.Text = "ID"
oTable.Cell(1, 2).Range.Text = "Nom"
oTable.Cell(1, 3).Range.Text = "Valeur"
oTable.Cell(1, 4).Range.Text = "Unité"
For Each ligne In TableB.Items
For c = 0 To nbcolonne - 1
oTable.Cell(nbligne + 2, c + 1).Range.Text = ligne.SubItems(c).Text
Next
nbligne += 1
Next
oTable.Rows.Item(1).Range.Font.Bold = True
oTable.Rows.Item(1).Range.Font.Italic = True
End If
oInfo.Range.Text = ""
oInfo.Range.InsertParagraphAfter() |
Partager