J
jskscxy
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi如何操作Excel执行分类汇总
var
xlApp: Variant;
begin
SaveGrid(DBGridEh1, DBGridEh1.DataSource.DataSet.Name);
try
xlApp := CreateOleObject('Excel.Application');
except
ShowMessage('您的机器里未安装Microsoft Excel。');
Exit;
end;
xlApp.Visible := true;
xlApp.workBooks.Open(PublicFunction.FName);
//执行分类汇总
xlApp.Range['F1'].Subtotal(GroupBy:=6, Function:=-4157, TotalList:=10, Replace:=True, PageBreaks:=False, SummaryBelowData:=True);
end;
这样可以执行分类汇总,但只能对第10列进行汇总,实际友好几列
TotalList参数应该怎么写,要汇总的列数不确定
var
xlApp: Variant;
begin
SaveGrid(DBGridEh1, DBGridEh1.DataSource.DataSet.Name);
try
xlApp := CreateOleObject('Excel.Application');
except
ShowMessage('您的机器里未安装Microsoft Excel。');
Exit;
end;
xlApp.Visible := true;
xlApp.workBooks.Open(PublicFunction.FName);
//执行分类汇总
xlApp.Range['F1'].Subtotal(GroupBy:=6, Function:=-4157, TotalList:=10, Replace:=True, PageBreaks:=False, SummaryBelowData:=True);
end;
这样可以执行分类汇总,但只能对第10列进行汇总,实际友好几列
TotalList参数应该怎么写,要汇总的列数不确定