Excel文件发布为Web:
通过Delphi的 Import type library 引入Microsoft Excel9.0 Object Library
中的TExcelApplication,TExcelWorkbook,TExcelWorksheet三个控件(注意: 安装之前
对它们三个改名,以区别于97版本的相应控件)这里均加上后缀2000
var
ExcelApplication2000_1: TExcelApplication2000;
ExcelWorkbook2000_1: TExcelWorkbook2000;
ExcelWorksheet2000_1: TExcelWorksheet2000;
const
file_string='E:/xlwer.xls';
begin
try
//打开xlwer.xls,将其与当前Excelworkbook联系起来
ExcelWorkbook2000_1.ConnectTo(
ExcelApplication2000_1.Workbooks.Open(
file_string,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,
EmptyParam,EmptyParam,0));
//将xlwer.xls的工作页与Excelworksheet联系起来
ExcelWorksheet2000_1.ConnectTo(
ExcelWorkbook2000_1.Activesheet
as _Worksheet);
//将当前的Excelworksheet工作页发布为Web页
ExcelWorksheet2000_1.SaveAs('E:/victory1.htm');
finally
ExcelApplication2000_1.Quit;
ExcelWorksheet2000_1.Disconnect;
ExcelWorkbook2000_1.Disconnect;
ExcelApplication2000_1.Disconnect;
end;
end;