看office得help就足够了! 上面有关于excel编程方面的! 我以前写控制excel的程序就是看
那上面的!看下面的代码!
Application.ProcessMessages;
try
ExcelApplication1.Connect;
Except
statusbar1.Panels.Items[0].Text:='Excel硈钡ア毖,叫浪琩Excel琌?Τ?杆...';
ComboBox1.SetFocus;
bitbtn1.Enabled:=true;
bitbtn2.Enabled:=true;
bitbtn3.Enabled:=true;
exit
end;
ExcelApplication1.Visible[0]:=FALSE;
ExcelApplication1.Workbooks.Add(xlWBATWorksheet,0);
statusbar1.Panels.Items[0].Text:='タ?砞﹚Excel?Α???';
statusbar1.Refresh;
asheet:=ExcelApplication1.ActiveSheet;
asheet.pagesetup.orientation:=xlLandscape;
//砞竚??よ?
asheet.pagesetup.leftMargin:=Excelapplication1.InchesToPoints(0.006220440945);
// 砞竚
asheet.pagesetup.rightMargin:=Excelapplication1.InchesToPoints(0.0000787401575e-02);
// ??
asheet.pagesetup.topMargin:=Excelapplication1.InchesToPoints(0.236220472440945);
// 娩禯
asheet.pagesetup.bottomMargin:=Excelapplication1.InchesToPoints(0.35748031496063);
//
Excelapplication1.ActiveWindow.Zoom:=100;
asheet.name:='??畐?';
asheet.cells[1,2]:='界?龟穨??Τ?そ???畐?厨?';
asheet.range[asheet.cells[1,1],asheet.cells[1,10]].font.size:=18;
asheet.range[asheet.cells[1,1],asheet.cells[1,10]].font.bold:=true;
asheet.range[asheet.cells[1,1],asheet.cells[1,10]].font.NAME:='夹发砰';
asheet.range[asheet.cells[1,2],asheet.cells[1,12]].Merge;
asheet.cells[1,2].Horizontalalignment:=xlcenter;
asheet.cells[2,1]:='??ら戳:';
asheet.cells[2,1].Horizontalalignment:=xlleft;
//逆?ず甧﹡オ
asheet.cells[2,2].NumberFormatLocal:='yyyy-mm-dd';//砞竚ら戳陪ボ?Α
asheet.cells[2,2]:=datetostr(date);
asheet.Range[asheet.cells[2,2],asheet.cells[2,3]].Merge;
asheet.cells[2,2].Horizontalalignment:=xlleft;
//逆?ず甧﹡い,??
asheet.cells[3,1]:='??絪腹';
asheet.cells[3,1].Horizontalalignment:=xlcenter;
asheet.cells[3,2]:='???嘿';
asheet.cells[3,2].Horizontalalignment:=xlcenter;
asheet.range[asheet.cells[3,2],asheet.cells[3,3]].Merge;
//??
asheet.cells[3,4]:='虫?';
asheet.cells[3,4].Horizontalalignment:=xlcenter;
asheet.cells[3,5]:='?る挡?';
asheet.cells[3,5].Horizontalalignment:=xlcenter;
asheet.cells[3,6]:='?畐计秖';
asheet.cells[3,6].Horizontalalignment:=xlcenter;
asheet.cells[3,7]:='?畐计秖';
asheet.cells[3,7].Horizontalalignment:=xlcenter;
asheet.cells[3,8]:='挡?计秖';
asheet.cells[3,8].Horizontalalignment:=xlcenter;
asheet.cells[3,9]:='虫基';
asheet.cells[3,10]:='刽?';
asheet.cells[3,11]:='? 璸';
asheet.cells[3,11].Horizontalalignment:=xlcenter;
asheet.cells[3,12]:='畐???';
asheet.cells[3,12].Horizontalalignment:=xlcenter;
asheet.cells[3,13]:='钵笆ら戳';
asheet.cells[3,13].Horizontalalignment:=xlcenter;
asheet.cells[3,14]:='紅 坝';
asheet.cells[3,14].Horizontalalignment:=xlcenter;
asheet.cells[3,15]:='? 砰';
asheet.cells[3,15].Horizontalalignment:=xlcenter;
asheet.range[asheet.cells[3,15],asheet.cells[3,16]].Merge;
//??
statusbar1.Panels.Items[0].Text:='タ?蹲?戈????';
ClientDataSet1.First;
i:=4;
J:=0;
Gauge1.Visible:=true;
Gauge1.MinValue:=0;
Gauge1.Progress:=0;
Gauge1.MaxValue:=ClientDataSet1.RecordCount;
While Not ClientDataSet1.Eof do
begin
asheet.cells[i,1]:=''''+ClientDataSet1.FieldByName('ano').AsString+'-'+ClientDataSet1.FieldByName('bno').AsString;
asheet.cells[i,2]:=''''+ClientDataSet1.FieldByName('mat_na').AsString;
asheet.cells[i,4]:=''''+ClientDataSet1.FieldByName('unit').AsString;
asheet.cells[i,5]:=ClientDataSet1.FieldByName('LAST_BALANCE').AsString;
asheet.cells[i,6]:=ClientDataSet1.FieldByName('iqty').AsString;
asheet.cells[i,7]:=ClientDataSet1.FieldByName('oqty').AsString;
asheet.cells[i,8]:=ClientDataSet1.FieldByName('tqty').Asstring;
asheet.cells[i,9]:=ClientDataSet1.FieldByName('price').AsString;
asheet.cells[i,10]:=ClientDataSet1.FieldByName('exch' ).AsString;
asheet.cells[i,12]:=ClientDataSet1.FieldByName('rname').AsString;
if ClientDataSet1.FieldByName('idate').AsString>ClientDataSet1.FieldByName('odate').AsString then
asheet.cells[i,13]:=ClientDataSet1.FieldByName('idate').AsString
else
asheet.cells[i,13]:=ClientDataSet1.FieldByName('odate').AsString ;
asheet.cells[i,14]:=ClientDataSet1.FieldByName('SNAMES' ).AsString;
asheet.cells[i,15]:=''''+ClientDataSet1.FieldByName('artic_no').AsString;
asheet.range[asheet.cells[I,2],asheet.cells[I,3]].Merge;
//??
asheet.range[asheet.cells[I,15],asheet.cells[I,16]].Merge;
//??
inc(j);
// Statusbar1.Panels.Items[1].Text:='[材'+INTTOSTR(J)+'掸 /?'+IntToStr(ClientDataSet1.RecordCount)+'掸]';
Application.ProcessMessages;
ClientDataSet1.Next;
inc(i);
Gauge1.Progress:=j;
end;
Statusbar1.Panels.Items[0].Text:='戈?锣郎Θ?,タ?ЧΘ?砰の?絬砞竚??';
Application.ProcessMessages;
statusbar1.Panels.Items[1].Text:='';
asheet.cells[i,2].columnwidth:=16;
asheet.cells[i,4].columnwidth:=2.5;
asheet.cells[i,4].Horizontalalignment:=xlcenter;
asheet.cells[i,5].columnwidth:=10.5;
asheet.cells[i,9].columnwidth:=4.7;
asheet.cells[i,10].columnwidth:=3;
asheet.range[asheet.cells[2,1],asheet.cells[I,20]].font.size:=9;
asheet.Range[asheet.cells[3,1],asheet.cells[i-1,16]].borders.LineStyle:=xlContinuous;
//礶?絬
ExcelApplication1.Visible[0]:=true;
ExcelApplication1.Disconnect;
其中的汉字是繁体的! 没有改,不过无所谓!