D
discovered
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TfrmMain.RzBitBtn1Click(Sender: TObject);
var
I, J: Integer;
ExcelFileName,mychar: string;
FExcel,FWorkBook: OleVariant;
begin
if dxm_ar_apply1.count <= 0 then
begin
Application.MessageBox('No Data,Please check...!',
pchar(application.title),
MB_ICONINFORMATION + MB_DEFBUTTON1 + MB_OK);
exit;
end;
if Trim(edtsave1.Text)='' then
ExcelFileName := ExtractFilePath(Application.ExeName)+'00114Snd.xls'
else
ExcelFileName := Trim(edtsave1.Text)+'00114Snd.xls';
Screen.Cursor := crDefault;
try
FExcel := CreateOleObject('Excel.Application');
FExcel.visible := False;
FworkBook := CreateOleObject('Excel.Sheet');
FWorkBook := FExcel.Workbooks.Open(ExtractFilePath(Application.ExeName)+'/Template/00114Sndmod.xls');
j:=2;
for I := 0 to dxm_ar_apply1.count - 1 do
begin
if dxm_ar_apply1.Items.Values[dxt_ar_apply1sel.Index]='1' then
begin
fexcel.Cells[j,1] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YW_type.Index]);//业务类型号
fexcel.Cells[j,2] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQR_account.Index]);//发起人账号
fexcel.Cells[j,3] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1cmp_name.Index]);//发起人名称
fexcel.Cells[j,4] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQR_ad.Index]);//发起人地址
fexcel.Cells[j,5] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQR_QS.Index]);//发起行清算行行号
fexcel.Cells[j,6] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQH_account.Index]);//发起开户行行号
fexcel.Cells[j,7] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1ACCOUNTNO.Index]);//接收人账号
fexcel.Cells[j,8] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1CNAME.Index]);//接收人名称
fexcel.Cells[j,9] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1BANKNAME.Index]);//接收人行名
fexcel.Cells[j,10] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1JHQ_account.Index]);//接收清算行行号
fexcel.Cells[j,11] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1KH_no.Index]);//接收开户行行号
fexcel.Cells[j,12] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1JH_no.Index]);//接收行交换号
fexcel.Cells[j,13] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1HBH.Index]);//货币号
fexcel.Cells[j,14] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1partnum.Index]);//金额
fexcel.Cells[j,15] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1ZY.Index]);//摘要
fexcel.Cells[j,16] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWkeytype.Index]);//业务键种类
fexcel.Cells[j,17] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWkey.Index]);//业务键
fexcel.Cells[j,18] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWtype.Index]);//业务种类
fexcel.Cells[j,19] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1XY_no.Index]);//多方协议号
fexcel.Cells[j,20] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWnum.Index]);//业务序号
j := j+1;
end;
end;
FExcel.ActiveWorkBook.SaveAs(ExcelFileName);
finally
FExcel.ActiveWorkBook.Saved:=True;
FExcel.DisplayAlerts := false;
FWorkBook.close;
FExcel.Quit; //退出Excel Application
//释放VARIANT变量
FWorkBook := Unassigned;
FExcel := Unassigned;
ShowMsg('文件导出成功!','提示');
end;
end;
-------上段代码在XP能够导出,可在windows 2000系统下却会报这个错
Variant does not reference an automation object
我查了一下,XP下有Dcom server process launcher这个服务
而2000下没有这个服务,要怎么解决,2000下可以装这个服务吗?怎么装,脆求大家啦.
var
I, J: Integer;
ExcelFileName,mychar: string;
FExcel,FWorkBook: OleVariant;
begin
if dxm_ar_apply1.count <= 0 then
begin
Application.MessageBox('No Data,Please check...!',
pchar(application.title),
MB_ICONINFORMATION + MB_DEFBUTTON1 + MB_OK);
exit;
end;
if Trim(edtsave1.Text)='' then
ExcelFileName := ExtractFilePath(Application.ExeName)+'00114Snd.xls'
else
ExcelFileName := Trim(edtsave1.Text)+'00114Snd.xls';
Screen.Cursor := crDefault;
try
FExcel := CreateOleObject('Excel.Application');
FExcel.visible := False;
FworkBook := CreateOleObject('Excel.Sheet');
FWorkBook := FExcel.Workbooks.Open(ExtractFilePath(Application.ExeName)+'/Template/00114Sndmod.xls');
j:=2;
for I := 0 to dxm_ar_apply1.count - 1 do
begin
if dxm_ar_apply1.Items.Values[dxt_ar_apply1sel.Index]='1' then
begin
fexcel.Cells[j,1] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YW_type.Index]);//业务类型号
fexcel.Cells[j,2] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQR_account.Index]);//发起人账号
fexcel.Cells[j,3] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1cmp_name.Index]);//发起人名称
fexcel.Cells[j,4] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQR_ad.Index]);//发起人地址
fexcel.Cells[j,5] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQR_QS.Index]);//发起行清算行行号
fexcel.Cells[j,6] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1FQH_account.Index]);//发起开户行行号
fexcel.Cells[j,7] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1ACCOUNTNO.Index]);//接收人账号
fexcel.Cells[j,8] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1CNAME.Index]);//接收人名称
fexcel.Cells[j,9] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1BANKNAME.Index]);//接收人行名
fexcel.Cells[j,10] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1JHQ_account.Index]);//接收清算行行号
fexcel.Cells[j,11] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1KH_no.Index]);//接收开户行行号
fexcel.Cells[j,12] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1JH_no.Index]);//接收行交换号
fexcel.Cells[j,13] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1HBH.Index]);//货币号
fexcel.Cells[j,14] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1partnum.Index]);//金额
fexcel.Cells[j,15] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1ZY.Index]);//摘要
fexcel.Cells[j,16] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWkeytype.Index]);//业务键种类
fexcel.Cells[j,17] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWkey.Index]);//业务键
fexcel.Cells[j,18] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWtype.Index]);//业务种类
fexcel.Cells[j,19] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1XY_no.Index]);//多方协议号
fexcel.Cells[j,20] := VarToStr(dxm_ar_apply1.Items.Values[dxt_ar_apply1YWnum.Index]);//业务序号
j := j+1;
end;
end;
FExcel.ActiveWorkBook.SaveAs(ExcelFileName);
finally
FExcel.ActiveWorkBook.Saved:=True;
FExcel.DisplayAlerts := false;
FWorkBook.close;
FExcel.Quit; //退出Excel Application
//释放VARIANT变量
FWorkBook := Unassigned;
FExcel := Unassigned;
ShowMsg('文件导出成功!','提示');
end;
end;
-------上段代码在XP能够导出,可在windows 2000系统下却会报这个错
Variant does not reference an automation object
我查了一下,XP下有Dcom server process launcher这个服务
而2000下没有这个服务,要怎么解决,2000下可以装这个服务吗?怎么装,脆求大家啦.