Bonjour , quand je crée mon tableau au lieu d'avoir cela :



j'ai cela



le 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 
procedure TFenetre_termite.espacement(lienFichier:string);
Var Tableau:Table;
    i:Integer;
    DefaultTableBehavior,
    AutoFitBehavior: OleVariant;
    Lignes: Rows;
    BeforeRow: OleVariant;
    cheminFichier, aFileName, NomDuFichier: olevariant ;
    monFichier : _document;
    Repertoire:string ;
    Visible: olevariant;
    Zone:Range;
    Signet:OleVariant;
    mesFichiers, MaZone, mesSignets, placeSignet, monSignet : olevariant;
    numero,lecture_page,num_onglet,NumTableau:integer ;
    TabPageetage,TabPagepiece:TTabPage ;
    aComposant :TControl  ;
    acheck :TCheckBox ;
    etageTableau:integer ;
 
begin
 
////////////////////  ouverture du fichier word nom rempli    //////////////////////////////////////
 
  Repertoire := ExtractFilePath(Application.ExeName);
  cheminFichier := Repertoire+'../fichierWord/termite.doc';
  Visible := true ;
  monFichier := ApplicationWord.Documents.Open(cheminFichier,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,Visible,EmptyParam,EmptyParam,EmptyParam);
 
///////////////// detection emplacement du future tableau ////////////////////////////
 
  Signet:='TableauConfigurationDevis';
  Zone:=monFichier.Bookmarks.Item(Signet).Range;
 
////////////////////  création du tableau  ////////////////////////////////////////////
  DefaultTableBehavior:=wdWord8TableBehavior;
  AutoFitBehavior:=wdWord8TableBehavior;
 
 
  Tableau:=monFichier.Tables.Add( Zone,1,3,DefaultTableBehavior,AutoFitBehavior);
 
 
 
 
////////////////////  mise en forme du tableau    //////////////////////////////////////
  With Tableau Do
  Begin
    Borders.Item(wdBorderLeft).LineStyle := wdLineStyleNone;
    Borders.Item(wdBorderRight).LineStyle := wdLineStyleNone;
    Borders.Item(wdBorderTop).LineStyle := wdLineStyleNone;
    Borders.Item(wdBorderBottom).LineStyle := wdLineStyleNone;
    Borders.Item(wdBorderHorizontal).LineStyle := wdLineStyleNone;
    Borders.Item(wdBorderVertical).LineStyle := wdLineStyleNone;
    Borders.Shadow := False;
  End;
 
 
/////////////////   enregistrement de la gestion d'onglet   ///////////////////////////////
 
if assigned(TNB_principal) then  // verification de la presence du premier TNB
    begin
      For lecture_page:= 0 to TNB_principal.Pages.Count-1  do  // lecture des differents étages
        Begin
          TabPageetage := TTabPage(TNB_principal.Pages.Objects[lecture_page]);
            if assigned(TabPage) then
              begin
                Tableau.Cell(etageTableau,2).Range.Text := TabPageetage.Caption ; //insertion de l'étage dans le tableau
                BeforeRow:=Tableau.Rows.Item(Tableau.Rows.Count);
                Tableau.Rows.Add(BeforeRow);
                etageTableau := etageTableau+1 ;
                For num_onglet:= 0 to TNB_principal1[lecture_page].Pages.Count-1  do // lecture des differentes piece
                  Begin
                    TabPagepiece := TTabPage(TNB_principal1[lecture_page].Pages.Objects[num_onglet]);
                    miseEnFormeMot(TabPagepiece.Caption);
                    Tableau.Cell(etageTableau,1).Range.Text := motFinal ; // insertion de la piece dans le tableau
                    For NumTableau:=0 to Pred( TabPagepiece.ControlCount ) do // recherche du composant de type checkBox du nom de CBX_test
                      begin
                        aComposant := TControl.Create(self);
                        aComposant := TabPagepiece.Controls[NumTableau] ;
                        if TabPagepiece.Controls[NumTableau] is TCheckBox then
                          begin
                            recupere_mot(aComposant.Name, Length(aComposant.Name)-3, 1);
                            acheck := TCheckBox.Create(self);
                            acheck := (aComposant as TCheckBox);
                        if mots='CBX_test' then
                          begin
                            if acheck.Checked = false then    // verifier si le composant et cocher ou pas
                              begin
                                Tableau.Cell(etageTableau,3).Range.Text := 'NON' ; // inserer l'état dans le tableau
                              end
                            else
                              begin
                                Tableau.Cell(etageTableau,3).Range.Text := 'OUI' ; // inserer l'état dans le tableau
                              end;
                              etageTableau := etageTableau+1 ;
                              BeforeRow:=Tableau.Rows.Item(Tableau.Rows.Count);
                              Tableau.Rows.Add(BeforeRow);
                          end;
                      end;
                    end;
            end;
        end;
    end;
 end;
 
 
/////////////////  enregistrement du fichier word rempli sous un autre nom     ///////////////////////////////
 
    aFileName :=  lienFichier ;
    monFichier.SaveAs(aFileName,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam);
    monFichier.Close(EmptyParam,EmptyParam,EmptyParam);
    ApplicationWord.Disconnect;
 
End;
Je ne comprend pas que mon premier ajout se retrouve tout en bas ...

Merci d'avance de vos réponses.