?
Solved

Embedding MS Word

Posted on 2003-03-10
5
Medium Priority
?
253 Views
Last Modified: 2010-04-04
Hi...

I am embedding MS Word into a Delphi Application. The problem that i have is when i resize the form  when Word is not activated... The OLE component does not change its size.

I want to be able to change the size of the Ole Container, and have Word change its size automatically.

Does somebody know how?

José Araujo
0
Comment
Question by:jiaf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Accepted Solution

by:
mfhobbs earned 300 total points
ID: 8134249
Hi, yeh, it's not an ideal situation.  In an OnResize event you have to do call a proc which does:

  if (...it is not active...) then
    if IsFullyVisible(...the container... or containing panel...) then
    begin
      ...activate...
      ...deactivate...
    end;

:)

Good luck,
-Mat

NB:

function IsFullyVisible(pWinControl: TWinControl): boolean;
begin
  Result := True;
  while (pWinControl <> nil) do
  begin
    if not pWinControl.Visible then
    begin
      Result := False;
      exit;
    end; //if
    pWinControl := pWinControl.Parent;
  end; //while
end; //IsFullyVisible
0
 

Author Comment

by:jiaf
ID: 8135822
The problem is that if i activate the OLE object (using ole.DoVerb(ovShow)) then the window if resized again,because the OLE object add a menu (i don't have a regular menu), and then it enters in a loop... I solved that with a flag variable... but i don't like it that way.

I know Outlook XP uses Word for writing emails, and it does not seem to have those problem. I am wondering where i can find information about how outlook interacts with word.
0
 

Expert Comment

by:mfhobbs
ID: 8143220
It's an arcane art.  I think Microsoft know all the tricks but as far as I know, they haven't released the details.  Perhaps Word is now like an Active-X control in XP?! Or now a base component... TWordEdit :)

In our app we have the ability to have 2 word windows open on the same form (upper and lower panels).  It works but, as you know, its not going to be as clean as it could be.

Good luck,
-Mat
0
 
LVL 3

Expert Comment

by:JDuncan
ID: 8395940

Try this

The resize wvent is for the panel or form that word is embedded into.

procedure TForm.PanelResize(Sender: TObject);
begin
  OleContainer1.Align:=alClient;
  OleContainer1.Refresh;
end;


JD

0
 

Expert Comment

by:CleanupPing
ID: 9316855
jiaf:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question