Z
zhangxuepu107
Unregistered / Unconfirmed
GUEST, unregistred user!
if SaveDialog1.Execute then
begin
Screen.Cursor:=crHourGlass;
ExcelApplication1.Connect;
ExcelApplication1.Workbooks.Add(Null,0);
ExcelWorkBook1.ConnectTo(ExcelApplication1.Workbooks[1]);
ExcelWorkSheet1.ConnectTo(ExcelWorkBook1.Sheets[1] as _WorkSheet);
ExcelWOrkSheet1.Cells.Item[1,1]:='出库日期';
ExcelWOrkSheet1.Cells.Item[1,2]:='手机名称';
ExcelWOrkSheet1.Cells.Item[1,3]:='手机型号';
ExcelWOrkSheet1.Cells.Item[1,4]:='手机串号';
ExcelWOrkSheet1.Cells.Item[1,5]:='业务员';
ExcelWOrkSheet1.Cells.Item[1,6]:='颜色';
ExcelWOrkSheet1.Cells.Item[1,7]:='出库原因';
ExcelWOrkSheet1.Cells.Item[1,8]:='出库标志';
ExcelWOrkSheet1.Cells.Item[1,9]:='出库审核日期';
// ExcelWOrkSheet1.Cells.Item[1,10]:='出库日期';
ExcelWOrkSheet1.Cells.Item[1,10]:='经销商';
ExcelWOrkSheet1.Cells.Item[1,11]:='出库备注';
cx_ck_cx.DisableControls;
row:=2;
while not cx_ck_cx.Eof do
begin
ExcelWOrkSheet1.Cells.Item[row,1]:=cx_ck_cx.fieldbyname('出库日期').asstring;
ExcelWOrkSheet1.Cells.Item[row,2]:=cx_ck_cx.fieldbyname('手机名称').asstring;
ExcelWOrkSheet1.Cells.Item[row,3]:=cx_ck_cx.fieldbyname('手机型号').asstring;
ExcelWOrkSheet1.Cells.Item[row,4]:=#39+cx_ck_cx.fieldbyname('手机串号').asstring;
ExcelWOrkSheet1.Cells.Item[row,5]:=cx_ck_cx.fieldbyname('业务员').asstring;
ExcelWOrkSheet1.Cells.Item[row,6]:=cx_ck_cx.fieldbyname('ck_sjys').asstring;
ExcelWOrkSheet1.Cells.Item[row,7]:=cx_ck_cx.fieldbyname('出库原因').asstring;
ExcelWOrkSheet1.Cells.Item[row,8]:=cx_ck_cx.fieldbyname('出库标志').asstring;
ExcelWOrkSheet1.Cells.Item[row,9]:=cx_ck_cx.fieldbyname('出库审核日期').asstring;
// ExcelWOrkSheet1.Cells.Item[row,10]:=cx_ck_cx.fieldbyname('出库日期').asstring;
ExcelWOrkSheet1.Cells.Item[row,10]:=cx_ck_cx.fieldbyname('经销商').asstring;
ExcelWOrkSheet1.Cells.Item[row,11]:=cx_ck_cx.fieldbyname('出库备注').asstring;
row:=row+1;
cx_ck_cx.Next;
end;
cx_ck_cx.EnableControls;
cx_ck_cx.First;
if (pos('.xls',SaveDialog1.FileName)>0) and (Length(SaveDialog1.FileName)=pos('.xls',SaveDialog1.FileName)+3) then
ExcelWorkBook1.SaveCopyAs(SaveDialog1.FileName)
else ExcelWorkBook1.SaveCopyAs(SaveDialog1.FileName+'.xls');
ExcelWOrkBook1.Close(false);
ExcelApplication1.Disconnect;
ExcelApplication1.Quit;
Screen.Cursor:=crDefault;
Application.MessageBox('导出成功!','系统提示',0);
end;
这是我的程序,在 2000系统下可以导出,但在xp系统中确报错,各位高手指点一下
begin
Screen.Cursor:=crHourGlass;
ExcelApplication1.Connect;
ExcelApplication1.Workbooks.Add(Null,0);
ExcelWorkBook1.ConnectTo(ExcelApplication1.Workbooks[1]);
ExcelWorkSheet1.ConnectTo(ExcelWorkBook1.Sheets[1] as _WorkSheet);
ExcelWOrkSheet1.Cells.Item[1,1]:='出库日期';
ExcelWOrkSheet1.Cells.Item[1,2]:='手机名称';
ExcelWOrkSheet1.Cells.Item[1,3]:='手机型号';
ExcelWOrkSheet1.Cells.Item[1,4]:='手机串号';
ExcelWOrkSheet1.Cells.Item[1,5]:='业务员';
ExcelWOrkSheet1.Cells.Item[1,6]:='颜色';
ExcelWOrkSheet1.Cells.Item[1,7]:='出库原因';
ExcelWOrkSheet1.Cells.Item[1,8]:='出库标志';
ExcelWOrkSheet1.Cells.Item[1,9]:='出库审核日期';
// ExcelWOrkSheet1.Cells.Item[1,10]:='出库日期';
ExcelWOrkSheet1.Cells.Item[1,10]:='经销商';
ExcelWOrkSheet1.Cells.Item[1,11]:='出库备注';
cx_ck_cx.DisableControls;
row:=2;
while not cx_ck_cx.Eof do
begin
ExcelWOrkSheet1.Cells.Item[row,1]:=cx_ck_cx.fieldbyname('出库日期').asstring;
ExcelWOrkSheet1.Cells.Item[row,2]:=cx_ck_cx.fieldbyname('手机名称').asstring;
ExcelWOrkSheet1.Cells.Item[row,3]:=cx_ck_cx.fieldbyname('手机型号').asstring;
ExcelWOrkSheet1.Cells.Item[row,4]:=#39+cx_ck_cx.fieldbyname('手机串号').asstring;
ExcelWOrkSheet1.Cells.Item[row,5]:=cx_ck_cx.fieldbyname('业务员').asstring;
ExcelWOrkSheet1.Cells.Item[row,6]:=cx_ck_cx.fieldbyname('ck_sjys').asstring;
ExcelWOrkSheet1.Cells.Item[row,7]:=cx_ck_cx.fieldbyname('出库原因').asstring;
ExcelWOrkSheet1.Cells.Item[row,8]:=cx_ck_cx.fieldbyname('出库标志').asstring;
ExcelWOrkSheet1.Cells.Item[row,9]:=cx_ck_cx.fieldbyname('出库审核日期').asstring;
// ExcelWOrkSheet1.Cells.Item[row,10]:=cx_ck_cx.fieldbyname('出库日期').asstring;
ExcelWOrkSheet1.Cells.Item[row,10]:=cx_ck_cx.fieldbyname('经销商').asstring;
ExcelWOrkSheet1.Cells.Item[row,11]:=cx_ck_cx.fieldbyname('出库备注').asstring;
row:=row+1;
cx_ck_cx.Next;
end;
cx_ck_cx.EnableControls;
cx_ck_cx.First;
if (pos('.xls',SaveDialog1.FileName)>0) and (Length(SaveDialog1.FileName)=pos('.xls',SaveDialog1.FileName)+3) then
ExcelWorkBook1.SaveCopyAs(SaveDialog1.FileName)
else ExcelWorkBook1.SaveCopyAs(SaveDialog1.FileName+'.xls');
ExcelWOrkBook1.Close(false);
ExcelApplication1.Disconnect;
ExcelApplication1.Quit;
Screen.Cursor:=crDefault;
Application.MessageBox('导出成功!','系统提示',0);
end;
这是我的程序,在 2000系统下可以导出,但在xp系统中确报错,各位高手指点一下