if opendialog1.Execute then
begin
filename:=opendialog1.FileName;
ExcelApplication1.Workbooks.Open(FileName,null,null,null,null,null,null,null,null,null,null,null,null,0);
excelapplication1.Visible[0]:=true;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[day] as _Worksheet);
end;
begin
filename:=opendialog1.FileName;
ExcelApplication1.Workbooks.Open(FileName,null,null,null,null,null,null,null,null,null,null,null,null,0);
excelapplication1.Visible[0]:=true;
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[day] as _Worksheet);
end;
解决方案 »
- 扫描本地端口
- 我已经被RICHEDIT做痕迹保留弄的焦头乱额了,帮帮忙啊
- 已在Excel中做好固定模版,如何将此模板存放在Access中以方便数据导出?
- 超级郁闷!只要采用智能ABC输入法录入中文信息,那么软件就会出现地址访问冲突,系统异常中断,不能退出系统,其他任何输入法都没问题。
- 收集ACTIVEX DLL代码!!哪们有好的代码,能不能贡献出来,让大家学习学习!!贴着有分!
- 在DBGrid中如何不显示Indicator(记录位置指示器)?
- CSDN的管理员是干什么吃的????????????
- 为什么这样查不到数据?代码如下:
- 帮我看看这个函数
- 抢分题目,我的数据库的字段名太多了,请问TDBCtrlGrid能否让它的每个panel有滚动条?
- 三谈多态——善用virtual
- SocketConnection动态连接的问题
ExcelApplication1.Visible[0]:=False; if OpenDialog1.Execute then
begin
ExcelApplication1.Workbooks.Add(OpenDialog1.FileName,0);
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[1] as _Worksheet);
end;
row:=2;
s1:='';
Table1.Active := True;
s1:=ExcelWorksheet1.Cells.Item[row,1];
while s1<>'' do
begin
Queryc.Close;
Queryc.SQL.Clear;
Queryc.SQL.Add('select FromProvince from FromCity where DataDate= :dataa and FromProvince= :province and FromCity= :city ' );
Queryc.Prepare;
Queryc.Params[0].AsDateTime:=StrToDate(Edit1.Text);
('province').AsString:=ExcelWorksheet1.Cells.Item[row,1];
Queryc.Params[1].AsString:=ExcelWorksheet1.Cells.Item[row,1];
Queryc.Params[2].AsString:=ExcelWorksheet1.Cells.Item[row,2];
Queryc.Open;
Queryc.First;
if Queryc.Eof then
begin
Table1.Insert;
Table1.FieldValues['DataDate']:=StrToDate(Edit1.Text);
Table1.FieldValues['FromProvince']:=ExcelWorksheet1.Cells.Item[row,1];
Table1.FieldValues['FromCity']:=
ExcelWorksheet1.Cells.Item[row,2];
Table1.FieldValues['UseCount']:=
ExcelWorksheet1.Cells.Item[row,3];
Table1.FieldValues['UseTime']:=
ExcelWorksheet1.Cells.Item[row,4];
Table1.FieldValues['UseAmount']:=
ExcelWorksheet1.Cells.Item[row,5];
Table1.post;
end;
row:=row+1;
s1:=ExcelWorksheet1.Cells.Item[row,1];
end;
Table1.Active := False;
ExcelWorksheet1.Disconnect;
ExcelWorkbook1.Disconnect;
ExcelApplication1.Quit;
ExcelApplication1.Disconnect;
shellexecut(handle,nil,'*.xls',nil,nil,sw_shownormal);
ExcelApplication1.Visible[0]:=False; if OpenDialog1.Execute then
begin
ExcelApplication1.Workbooks.Add(OpenDialog1.FileName,0);
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[1] as _Worksheet);
end;
row:=2;
s1:='';
Table1.Active := True;
s1:=ExcelWorksheet1.Cells.Item[row,1];
while s1<>'' do
begin
Table1.Insert;
Table1.FieldValues['DataDate']:=StrToDate(Edit1.Text);
Table1.FieldValues['FromProvince']:=ExcelWorksheet1.Cells.Item[row,1];
Table1.FieldValues['FromCity']:=
ExcelWorksheet1.Cells.Item[row,2];
Table1.FieldValues['UseCount']:=
ExcelWorksheet1.Cells.Item[row,3];
Table1.FieldValues['UseTime']:=
ExcelWorksheet1.Cells.Item[row,4];
Table1.FieldValues['UseAmount']:=
ExcelWorksheet1.Cells.Item[row,5];
Table1.post;
row:=row+1;
s1:=ExcelWorksheet1.Cells.Item[row,1];
end;
Table1.Active := False;
ExcelWorksheet1.Disconnect;
ExcelWorkbook1.Disconnect;
ExcelApplication1.Quit;
ExcelApplication1.Disconnect;