T
trident99
Unregistered / Unconfirmed
GUEST, unregistred user!
我使用webbrowser浏览excel ,用excelapplicaton excelworkbook excelworksheet进行保存/打印/打印预览;
保存 和 打印 都可实现 ,但打印预览出现ole错误,
连接excel的代码如下
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=false;
ExcelApplication1.Caption:='111';
//excelapplication1.Workbooks.open('c:/a.xls',null,null,null,null,null,null,null,null,null,null,null,null,0);//打开指定的EXCEL 文件
webbrowser1.Navigate('c:/a.xls');
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);//ExcelWorkbook1与Eexcelapplication1建立连接
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[1] as _Worksheet);//Excelworksheet1与Excelworkbook1建立连接
打印预览的代码如下
excelworksheet1.PrintPreview;
保存 和 打印 都可实现 ,但打印预览出现ole错误,
连接excel的代码如下
ExcelApplication1.Connect;
ExcelApplication1.Visible[0]:=false;
ExcelApplication1.Caption:='111';
//excelapplication1.Workbooks.open('c:/a.xls',null,null,null,null,null,null,null,null,null,null,null,null,0);//打开指定的EXCEL 文件
webbrowser1.Navigate('c:/a.xls');
ExcelWorkbook1.ConnectTo(ExcelApplication1.Workbooks[1]);//ExcelWorkbook1与Eexcelapplication1建立连接
ExcelWorksheet1.ConnectTo(ExcelWorkbook1.Worksheets[1] as _Worksheet);//Excelworksheet1与Excelworkbook1建立连接
打印预览的代码如下
excelworksheet1.PrintPreview;