如何获取系统菜单名列

1、在主界面模块上放置openoffice控件,并改名为MO1
2、添加如下过程
procedure TForm1.PrintAllMenuItem(AMainMenu: TMainMenu; XRow: Integer);
function FindChindMenuItem(AMeunItem: TMenuItem; YCol: Integer): Boolean;
var
i: Integer;
begin
MO1.SetCellString(Xrow,YCol,AMeunItem.Caption);
if AMeunItem.Count = 0 then
begin
Inc(XRow);
Exit;
end;
for i := 0 to AMeunItem.Count-1 do
begin
if AMeunItem.Items[i].Visible then
FindChindMenuItem(AMeunItem.Items[i],YCol+1);
end;
end;
begin
MO1.ExportType := theOpenOffice;
MO1.NewDoc();
FindChindMenuItem(AMainMenu.Items,1);
MO1.Disconnect;
ShowMessage('ComPlete!');
end;
 
3、在主界面模块放置一个Button控件,Button.Click事件代码为
procedure TForm1.Button1Click(Sender: TObject);
begin
PrintAllMenuItem(MainMenu1,1);
end;
 
运行系统,点击Button即为转出系统菜单项的Excel档。

posted on 2015-06-03 11:40  黃廣訊  阅读(341)  评论(0编辑  收藏  举报

导航