Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1206
  • Last Modified:

OLEContainer (Word) keep the menu(s) in the container!

Delphi6 Pro
MS Word 2002
Windows XP Home (Urgh!)

Hi Guys / Girls,
I have a small query but one that is indeed bugging me.
I have a form with 2 panels (1 align left) (2 align client) with a splitter in-between. On the left hand panel I have a list of word documents and when the user selects a document from the list, it opens in the OLE container on the Panel2.

ie

OLEContainer1.CreateObjectFromFile('c:\guide uk.doc',False);

All very straightforward, but!. When the Word menu bar is activated for editing, the menu bars are created along the top of the form and NOT within the container. This is a problem as it throws all the screen design out.

How can I keep all associated word menus etc within the bounds of the olecontainer?

Cheers for any assistance

Stu
0
08718712060
Asked:
08718712060
  • 4
  • 2
1 Solution
 
08718712060Author Commented:
SORRY FOR THE LOW POINTS (RUNNING SHORT)
0
 
mocartsCommented:
at the moment I found a solution how to disable menu merging (and main form overlaying by olecontainer)..
but there is some problem with main menu on contained form (not really a problem, as it's normally when form have one main menu, but we want another one)

...
ole1: TOleContainer;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
  ole1.Parent.Visible := False;
  ole1.Parent.Parent := nil;
  try
  ole1.CreateObjectFromFile('D:\my.doc', false);
  finally
    ole1.Parent.Parent := Panel2;
    ole1.Parent.VIsible := True;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
 f: TForm;
begin
  f:= TForm.Create(Self);
  with f do begin
    BorderStyle := bsNone;
    BorderIcons := [];
    Align := alClient;
  end;
  Ole1 := TOleContainer.Create(f);
  Ole1.Parent := f;
  Ole1.Align := alClient;
end;

wbr, mo.
0
 
08718712060Author Commented:
Cheers mocarts,
Life saving isnt close enough to the mark!. cheers m8
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
08718712060Author Commented:
mocarts,
Just a quicky if you are still getting alerts from this post.

How can I open the word document (read only) ie no menus?
0
 
mocartsCommented:
do you mean readonly when activated? (at the moment I don't know how to manage it, but you can look in ObjectVerbs property of container - maybe there is something useful?)
or you simply want to browse through document?
in such case set AutoActivate property to aaManual and when you need edit the document call olecontainer.DoVerb(ovShow) method.

wbr, mo.
0
 
08718712060Author Commented:
Cheers mocarts, I think I may need to look at embedding TWordApplication in a form / panel as opposed to OLEContainer.

Ill open a new post I think ,

Cheers for your help

S
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now