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
|
procedure TForm1.BitBtn1Click(Sender: TObject);
var
ExcelApp, ExcelWbx, ExcelWbk : variant;
i,j : integer;
begin
ExcelApp := CreateOleObject('Excel.Application');
ExcelApp.Visible := false;
ExcelWbx := ExcelApp.Workbooks;
ExcelWbk := ExcelWbx.Open('c:\PricerNS\Data\Pricer original.xls');
ExcelApp.cells[2,2].value := numdevis.caption;
ExcelApp.cells[2,5].value := datedev.date;
ExcelApp.cells[4,2].value := commercial.Text;
ExcelApp.cells[6,2].value := edit1.Text;
ExcelApp.cells[7,2].value := edit2.text;
ExcelApp.cells[8,2].value := edit3.Text + ' ' + edit4.Text;
ExcelApp.cells[8,3].value := edit5.Text + ' ' + edit6.Text;
j :=11;
for i := 0 to recap.finish.RowCount -1 do
begin
if recap.finish.Cells[0,i] = '1' then
excelApp.cells[j,i].value := recap.finish.Cells[1,i];
excelApp.cells[j,i].value := recap.finish.Cells[2,i];
j := j+1;
end;
//excelApp.workbook.close;
ExcelApp.quit;
ExcelApp := unassigned;
recap.Show; |
Partager