Bonjour , quand je crée mon tableau au lieu d'avoir cela :
j'ai cela
le code :
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.
(je post sur deux forum )