linkedin facebook linkedin facebook nod32

Delphida bajarilgan ishlarni Excelga yuborish

Muallif: Boyquziyev I.

Qo`shilgan sana: 2015-03-02

Delphida bajarilgan ishlarni Excelga yuborish

Quyida dasturning dizayni yaratib olamiz va shartnoma Excel faylga yuboramiz

Dastur kodi quyidagicha
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,comObj, ComCtrls;

type
TForm1 = class(TForm)
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit1: TEdit;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
ComboBox4: TComboBox;
ComboBox5: TComboBox;
Label1: TLabel;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Label2: TLabel;
Label3: TLabel;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Edit14: TEdit;
Edit15: TEdit;
Label4: TLabel;
Edit16: TEdit;
Label5: TLabel;
Label7: TLabel;
Edit17: TEdit;
Label8: TLabel;
Edit18: TEdit;
Button1: TButton;
Label6: TLabel;
ComboBox6: TComboBox;
ComboBox7: TComboBox;
ComboBox8: TComboBox;
ComboBox9: TComboBox;
ComboBox10: TComboBox;
Button2: TButton;
Label9: TLabel;
DateTimePicker1: TDateTimePicker;
Edit19: TEdit;
Label10: TLabel;
Edit20: TEdit;
Label11: TLabel;
Label12: TLabel;
Edit21: TEdit;
procedure Button1Click(Sender: TObject);
procedure Edit6Change(Sender: TObject);
procedure Edit7Change(Sender: TObject);
procedure Edit8Change(Sender: TObject);
procedure Edit9Change(Sender: TObject);
procedure Edit10Change(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Edit6Change(Sender: TObject);
begin
if (Edit6.Text<>'')and (Edit1.text<>'') then edit11.Text:=FloatToStr(StrToFloat(Edit1.text)*StrToFloat(Edit6.Text))else Edit11.Text:='';
end;

procedure TForm1.Edit7Change(Sender: TObject);
begin
if (Edit7.Text<>'')and (Edit2.text<>'') then edit12.Text:=FloatToStr(StrToFloat(Edit2.text)*StrToFloat(Edit7.Text)) else Edit12.Text:='';
end;

procedure TForm1.Edit8Change(Sender: TObject);
begin
if (Edit8.Text<>'')and (Edit3.text<>'') then edit13.Text:=FloatToStr(StrToFloat(Edit3.text)*StrToFloat(Edit8.Text)) else Edit13.Text:='';
end;

procedure TForm1.Edit9Change(Sender: TObject);
begin
if (Edit9.Text<>'')and (Edit4.text<>'') then edit14.Text:=FloatToStr(StrToFloat(Edit4.text)*StrToFloat(Edit9.Text)) else Edit14.Text:='';
end;

procedure TForm1.Edit10Change(Sender: TObject);
begin
if (Edit10.Text<>'')and (Edit5.text<>'') then edit15.Text:=FloatToStr(StrToFloat(Edit5.text)*StrToFloat(Edit10.Text)) else Edit15.Text:='';
end;

procedure TForm1.Button2Click(Sender: TObject);
var s:real;
begin
s:=0;
if edit11.Text<>'' then s:=s+StrToFloat(edit11.Text);
if edit12.Text<>'' then s:=s+StrToFloat(edit12.Text);
if edit13.Text<>'' then s:=s+StrToFloat(edit13.Text);
if edit14.Text<>'' then s:=s+StrToFloat(edit14.Text);
if edit15.Text<>'' then s:=s+StrToFloat(edit15.Text);
Edit16.Text:=FloatToStr(s);
Edit17.Text:=FloatToStr(s*0.15);
Edit18.Text:=FloatToStr(s*0.85);
Button1.Visible:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
var excel:variant;t:real;r:array[1..12]of real;i:integer;
m:array[1..12]of real;
begin
excel := createoleobject('Excel.Application');
excel.visible := true;
//d diskka shartnoma faylini excelda tayyorlab oling
excel.Workbooks.Open('D:\shartnoma.xls',true);
if ComboBox1.Text<>'' then excel.range['B5']:=ComboBox1.Text else excel.range['B5']:='X' ;
if ComboBox2.Text<>'' then excel.range['B6']:=ComboBox2.Text else excel.range['B6']:='X' ;
if ComboBox3.Text<>'' then excel.range['B7']:=ComboBox3.Text else excel.range['B7']:='X' ;
if ComboBox4.Text<>'' then excel.range['B8']:=ComboBox4.Text else excel.range['B8']:='X' ;
if ComboBox5.Text<>'' then excel.range['B9']:=ComboBox1.Text else excel.range['B9']:='X' ;
if Edit1.Text<>'' then excel.range['C5']:=Edit1.Text else excel.range['C5']:='';
if Edit2.Text<>'' then excel.range['C6']:=Edit2.Text else excel.range['C6']:='';
if Edit3.Text<>'' then excel.range['C7']:=Edit3.Text else excel.range['C7']:='';
if Edit4.Text<>'' then excel.range['C8']:=Edit4.Text else excel.range['C8']:='';
if Edit4.Text<>'' then excel.range['C9']:=Edit5.Text else excel.range['C9']:='';
if ComboBox6.Text<>'' then excel.range['D5']:=ComboBox6.Text else excel.range['D5']:='X' ;
if ComboBox7.Text<>'' then excel.range['D6']:=ComboBox7.Text else excel.range['D6']:='X' ;
if ComboBox8.Text<>'' then excel.range['D7']:=ComboBox8.Text else excel.range['D7']:='X' ;
if ComboBox9.Text<>'' then excel.range['D8']:=ComboBox9.Text else excel.range['D8']:='X' ;
if ComboBox10.Text<>'' then excel.range['D9']:=ComboBox10.Text else excel.range['D9']:='X' ;
if Edit6.Text<>'' then excel.range['E5']:=Edit6.Text else excel.range['E5']:='';
if Edit7.Text<>'' then excel.range['E6']:=Edit7.Text else excel.range['E6']:='';
if Edit8.Text<>'' then excel.range['E7']:=Edit8.Text else excel.range['E7']:='';
if Edit9.Text<>'' then excel.range['E8']:=Edit9.Text else excel.range['E8']:='';
if Edit10.Text<>'' then excel.range['E9']:=Edit10.Text else excel.range['E9']:='';
excel.range['B1']:=datetostr(DateTimePicker1.Date);
excel.range['B2']:=edit19.Text;

{t:=StrToFloat(Edit16.Text); m[12]:=100000000000;
for i:=11 downto 1 do
m[i]:=m[i+1]/10;
for i:=12 downto 1 do begin r[i]:=trunc(t/m[i]); if r[i]<>0 then t:=t-r[i]*m[i] else t:=t-trunc(t/m[i])*m[i]; edit16.text:=edit16.Text+FloatToStr(r[i]);

end;}
end;

END.

2479 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений