Bonjour
comment je peux changer l'emplacement de mon tableau ET LES LINES de text dans un document word
j'ai ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim wordApp As Word.Application
        Dim wordDoc As Word.Document
        Dim oPara1 As Word.Paragraph
        Dim oPara2 As Word.Paragraph
 
 
        'Démarrer un nouveau document dans Word 
        wordApp = CreateObject("Word.Application")
        wordDoc = wordApp.Documents.Open(Application.StartupPath & "\Exemple.dot")
 
        'wordApp = CType(CreateObject("Word.Application"), Word.Application))
        ' wordDoc = wordApp.Documents.Add()
 
        ''Effacer toute l'information existante. 
        wordDoc.Range.Delete()
        'Insert a paragraph at the beginning of the document.
        oPara1 = wordDoc.Content.Paragraphs.Add
        oPara1.Range.Text = "123456789012345678901234567890123456789012345678901234567890" & _
"123456789012345678901234567890123456789012345678901234567890123456789012"
        oPara1.Range.Font.Bold = True
        oPara1.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
        oPara1.Format.SpaceAfter = 24    '24 pt spacing after paragraph.
        oPara1.Range.InsertParagraphAfter()
        oPara2 = wordDoc.Content.Paragraphs.Add(wordDoc.Bookmarks.Item("\endofdoc").Range)
        oPara1.Range.Text = TXT1.Text
        oPara2.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphJustify
 
 
 
 
        'Mettre en place l'en-tête. 
        Dim Rng As Word.Range = wordDoc.Range(10, 10)
        Rng.Font.Name = "Verdana"
        Rng.Font.Size = 16
 
        Dim tlb As Word.Table = wordDoc.Tables.Add(Range:=Rng, NumRows:=4, NumColumns:=3)
        tlb.Borders.Enable = True
 
        'Remplissage des données à la table 
        'Row Header  
        tlb.Cell(1, 1).Range.Text = "Code"
        tlb.Cell(1, 2).Range.Text = "Nom"
        tlb.Cell(1, 3).Range.Text = "Montant"
 
        'Rangée de données 
        tlb.Cell(2, 1).Range.Text = "0001"
        tlb.Cell(2, 2).Range.Text = "Sandip"
        tlb.Cell(2, 3).Range.Text = "10000"
        tlb.Cell(2, 3).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
 
        tlb.Cell(3, 1).Range.Text = "0002"
        tlb.Cell(3, 2).Range.Text = "Ssmit"
        tlb.Cell(3, 3).Range.Text = "2000"
        tlb.Cell(3, 3).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
 
 
        tlb.Cell(4, 1).Range.Text = "0003"
        tlb.Cell(4, 2).Range.Text = "Doe"
        tlb.Cell(4, 3).Range.Text = "3000"
        tlb.Cell(4, 3).Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphRight
 
        wordApp.Visible = True
 
 
 
    End Sub
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
    End Sub
 
    Private Sub TXT1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXT1.TextChanged
 
    End Sub
End Class
Merci