例子看他的帮助文件 上面有很多 VB的例子
下面给你一段代码
procedure Treportfrm.baobiao6 ;
VAR
I,j:integer;
bm:string;
a:array[1..12] of DOUBLE;
sum:array[0..10] of DOUBLE;
month,year,day:word;
s:double;
query:string;
begin
//对YB1 进行汇总处理
f1book1.Read(ExtractFileDir(paramstr(0))+'/bao6.vts',typef);
with datamodule1.qry do
begin
with datamodlue1.ary do
begin
SQL.Add('SELECT ,DV,DM,NCJE,SDJ,SRJ,SRJ1,SRJ2,SRJ4,SRJ5,SRJ7,SRJ8,FCJ,FCJ1,FCJ4,FCJ3,FCJ5,FCJ2,QMJE FROM YB1');
OPEN;
I:=5;
WHILE NOT EOF DO
BEGIN
FOR J:=1 TO FIELDCOUNT DO
IF FIELDS[J-1].ASSTRING<>'0' THEN
IF J<=3 THEN
F1BOOK1.TEXTRC[I,J]:=FIELDS[J-1].ASSTRING
ELSE
F1BOOK1.NUMBERRC[I,J]:=FIELDS[J-1].ASFLOAT;
I:=I+1;
NEXT;
END;
END;
decodedate(now,year,month,day);
F1BOOK1.TextRC[1,1]:='1~'+INTTOSTR(monTH)+'月份原材料、能源收入、消费与库存报表';
F1BOOK1.TextRC[2,2]:=DATETOSTR(NOW);
f1book1.SetRowHeight(5,74,365,true);
f1book1.write(ExtractFileDir(paramstr(0))+'/bao4.xls',F1FileExcel5);
end;