如何控制OLE嵌入的Excel? 一个SDI程序,里面有一个OleContainer,其对象是一个Excel,我现在想控制这个Excel,修改表格的内容或者其他内容,不知道怎么实现,不知道各位大哥有没有建议? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var i, j: integer; ch: char; fn: string; sheet, range: OleVariant;begin if opendialog1.Execute then fn := opendialog1.FileName; if not fileExists(fn) then exit; OleContainer1.CreateObjectFromFile(fn, true); OleContainer1.DoVerb(ovShow); ExcelApp := OleContainer1.OleObject; ExcelApp.Application.CommandBars['Standard'].Visible := true; ExcelApp.Application.CommandBars['Formatting'].Visible := true;// sheet := ExcelApp.worksheets[1];// sheet.Activate;// range := sheet.range[sheet.cells[1, 1], sheet.cells[11, 10]]; // range.select; // range.merge; // ºÏ²¢µ¥Ôª¸ñ// range.borders.linestyle := xlcontinuous;// range.font.size := 9;end flashtong(阿木) :请问 ExcelApp 是什么类型的?如果是TExcelApplication,ExcelApp := OleContainer1.OleObject;无法通过编译如果是OleVariant或者Variant,ExcelApp := OleContainer1.OleObject;提示Interface not supported 还有一个奇怪的现象,我用:strFileName := ExtractFilePath(Application.ExeName) + 'AAAA.xls';OleContainer1.CreateObjectFromFile(strFileName, False);打开一个Excel文件,会提示“……已终止操作……”无法进行编辑,这个现象只在某几台电脑中有,有些电脑中却没有。在那些有提示的电脑中,我要是打开"AAAA.doc",一个Word文档,就能正常打开,不会产生这个提示,也能正常编辑。在那些有问题的电脑中,Excel程序是可以正常使用的。 flashtong(阿木) :ExcelApp是OleVariant类型的,上边提示的Interface not support是由于Excel加载有问题所致。我来打开WORD文档时,就可以了。 求助 delphi7连接sql2005连接速度问题 delphi打印控件 Delphi 调用 VC 写的 DLL 提示下列错误,跪求帮忙! 用socket做C/S遇到的一个关于长时间数据统计的问题:给个方案 写文档的时候,如何用Word制作目录? 如何隐藏随windows启动而启动的程序 cxGrid1TableView1Column1字段的扩展属性选RichEdit,如何操作RichEdit呢? 有关DBGrid的问题:我想要显示如下数据,请问怎样实现? 我的OICQ密码被盗,并且没有申请密码保护,请问怎样取回 找一个控件 时间日期计算问题,急 vista上网问题!
i, j: integer;
ch: char;
fn: string;
sheet, range: OleVariant;
begin
if opendialog1.Execute then
fn := opendialog1.FileName;
if not fileExists(fn) then exit;
OleContainer1.CreateObjectFromFile(fn, true);
OleContainer1.DoVerb(ovShow);
ExcelApp := OleContainer1.OleObject;
ExcelApp.Application.CommandBars['Standard'].Visible := true;
ExcelApp.Application.CommandBars['Formatting'].Visible := true;
// sheet := ExcelApp.worksheets[1];
// sheet.Activate;// range := sheet.range[sheet.cells[1, 1], sheet.cells[11, 10]];
// range.select;
// range.merge; // ºÏ²¢µ¥Ôª¸ñ
// range.borders.linestyle := xlcontinuous;
// range.font.size := 9;
end
请问 ExcelApp 是什么类型的?
如果是TExcelApplication,ExcelApp := OleContainer1.OleObject;无法通过编译
如果是OleVariant或者Variant,ExcelApp := OleContainer1.OleObject;提示Interface not supported
OleContainer1.CreateObjectFromFile(strFileName, False);打开一个Excel文件,会提示“……已终止操作……”无法进行编辑,这个现象只在某几台电脑中有,有些电脑中却没有。在那些有提示的电脑中,我要是打开"AAAA.doc",一个Word文档,就能正常打开,不会产生这个提示,也能正常编辑。在那些有问题的电脑中,Excel程序是可以正常使用的。
ExcelApp是OleVariant类型的,上边提示的Interface not support是由于Excel加载有问题所致。我来打开WORD文档时,就可以了。