小
小角色
Unregistered / Unconfirmed
GUEST, unregistred user!
这段代码是将excel嵌入到窗体中,可是我没有看到excel的菜单为什么?
测试时请在窗体中放入OleContainer控件和Button控件。
---------------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
xlApp, Sheet: Variant;
begin
OleContainer1.CreateObject('Excel.Sheet',true);
OleContainer1.DoVerb(ovSHOW);
xlapp:=OleContainer1.OleObject.Application;
xlapp.CommandBars['Standard'].Visible:= false;
xlapp.CommandBars['Formatting'].Visible:= false;
sheet := xlApp.WorkBooks[1].WorkSheets[1];
Sheet.Cells[1, 1] := '1234';
// OleContainer1.SaveAsDocument('c:/aa.xls');
end;
测试时请在窗体中放入OleContainer控件和Button控件。
---------------------------------------------------------------
procedure TForm1.Button1Click(Sender: TObject);
var
xlApp, Sheet: Variant;
begin
OleContainer1.CreateObject('Excel.Sheet',true);
OleContainer1.DoVerb(ovSHOW);
xlapp:=OleContainer1.OleObject.Application;
xlapp.CommandBars['Standard'].Visible:= false;
xlapp.CommandBars['Formatting'].Visible:= false;
sheet := xlApp.WorkBooks[1].WorkSheets[1];
Sheet.Cells[1, 1] := '1234';
// OleContainer1.SaveAsDocument('c:/aa.xls');
end;