From: Geoff Schaller on
Nick,

Its hard... and made all the more complex because MS Word itself is a
complex application with runtime issues of its own. If you think about
it, it is kind of bizarre that anyone thinks they should be able to run
it inside a container of their own and expect it to run properly.

If the object of the exercise is to "view" documents, then this is why
MS came up with the concept of a document viewer. Launching Word to then
edit a doc is a snap but launching it within a constrained physical
environment is always going to involve trauma.

IE8 has the concept of viewers built in. You get them as IE8 add-ins.
You can also go to code plex and find out how they do this in VB or C#
and then plagiarise for VO.

But little things will trip you up. Users can run Word in SDI or MDI
mode and they can flick between whenever they like. Even just this will
make your hosted control behave differently.

Good luck.

Geoff


"Nick Friend" <nicktekhne(a)googlemail.com> wrote in message
news:d4178bd4-4aac-43cb-8880-b0fa5cf28585(a)12g2000yqi.googlegroups.com:

> I'm not looking at this option from choice!
>
> Thing is I need to review and hopefully improve a lot of code written
> by someone else.... the application uses Word as a document viewer,
> but also (and more importantly) as the editor. At the moment Word is
> being embedded and controlled via a 3rd party OCX "shell" (soemthing
> called Edraw Officeviewer) in datawindows. But this is pretty slow and
> painful as it seems that instances of Word are being started and
> closed frequently (and somewhat .
>
> So I'm just trying to get some information together about possible
> solutions.... already the idea is to replace all viewing instances
> with a light-weight 3rd party doc viewer, and when editing is
> necessary swap into Word itself. But I'm curious as to why the
> original developer chose to wrap Word in the container OCX, and want
> to do some experiments working directly with Word.
>
> Doing some experimenting, it seems oddly inconsistent.... I've found
> that when activating the Word olecontrol for editing, sometimes it
> opens within the VO shell (adding the Word toolbar to the VO shell)
> and sometimes it opens a separate instance of Word in it's own
> window.... strange. Is it possible to force the datawindow containing
> the OLE control to be the "owner" so that the Word toolbar is placed
> on the datawindow instead of the shell? This would immediately
> simplify user-interface questions by completely containing the Word
> interface into the datawindow.
>
> Nick

From: Simon Goodman on
Hi Nick,

I use OLE automation to load and search / replace items in a word document
but dont actually show the document.

Not what you're after but let me know if you want a sample of this.

Simon



"Nick Friend" <nicktekhne(a)googlemail.com> wrote in message
news:d77730d7-36ce-4d92-b36d-2e241c49c846(a)g11g2000yqe.googlegroups.com...
> I'm doing a little investigation about using MS Word. Automation
> through OLEAutoObject is straightforward enough, but what about
> embedding Word in a VO window?
>
> I want to be able to carry out traditional OCX embedding, showing a
> doucment in view mode, then double click to activate full editing...
> is anyone doing this who can offer some tips?
>
> TIA
>
> Nick


From: Mathias on
Hi,

I have done the internet explorer trick for showing an excel workbook
in a c++ mfc application. I think that the hardest part to transfer to
VO is this. Unfortunately this is also the key to getting the the
dispatch handle to the excel application. Doing this with word would
probably be very similar.

BOOL CMyDlg::GetExcelDispatch()
{
CLSID clsid;
if (CLSIDFromProgID(OLESTR("Excel.Application"), &clsid) != NOERROR)
{
AfxMessageBox("Could not find excel clsid!",MB_OK | MB_ICONSTOP);
return false;
}

LPUNKNOWN lpUnk;
if (GetActiveObject(clsid, NULL, &lpUnk) == NOERROR)
{
LPDISPATCH lpDispatch;
HRESULT hr = lpUnk->QueryInterface(IID_IDispatch,
(LPVOID*)&lpDispatch);
lpUnk->Release();
if (hr == NOERROR)
{
m_ExcelApp.AttachDispatch(lpDispatch); // Remember IDispatch.
return true;
}
}

return false;
}

Mathias

On 28 Apr, 01:22, "Geoff Schaller" <geo...(a)softxwareobjectives.com.au>
wrote:
> 4 years of experience <g>.
>
> Let's start from the start: what are you really trying to achieve? I
> suspect it is a document viewer. Ok, we do such things in C# using the
> MS Office Tools for Visual Studio and related APIs. Here it is
> relatively easy to embed Word but the issue is whether this is
> appropriate. Imagine someone trying to embed your application into
> another? What do you do about menus, toolbars, MDI/SDI interface
> choices, closing Word, multiple instances, what if Word is already open,
> etc, etc.
>
> It is a mine field.
>
> Another way is to use a web browser to display a word doc and embedding
> a web browser in a VO app is a damned sight easier than embedding Word
> directly but it still comes with interface issues.
>
> I still think the simplest way is to get on to codeplex and find a
> document viewer in C# and do it that way. But MS Word is a very complex
> application with options the user can set that will upset this process.
>
> Geoff
>
> "Nick Friend" <nicktek...(a)googlemail.com> wrote in message
>
> news:b1b4ceab-a691-49af-a6d2-e06187886627(a)y17g2000yqd.googlegroups.com:
>
>
>
> > Geoff,
>
> > What exactly makes you say this?
>
> > Nick
>
> > On 27 Apr, 23:06, "Geoff Schaller" <geo...(a)softxwareobjectives.com.au>
> > wrote:
>
> > > You will have trouble all the way.
>
> > > I suggest you rethink this.
>
> > > "Nick Friend" <nicktek...(a)googlemail.com> wrote in message
>
> > >news:d77730d7-36ce-4d92-b36d-2e241c49c846(a)g11g2000yqe.googlegroups.com:
>
> > > > I'm doing a little investigation about using MS Word. Automation
> > > > through OLEAutoObject is straightforward enough, but what about
> > > > embedding Word in a VO window?
>
> > > > I want to be able to carry out traditional OCX embedding, showing a
> > > > doucment in view mode, then double click to activate full editing...
> > > > is anyone doing this who can offer some tips?
>
> > > > TIA
>
> > > > Nick- Hide quoted text -
>
> > > - Show quoted text -

From: richard.townsendrose on
Nick

why use ms word ??? ... why not use RTF ...

it has 99% of what people need ...

we use rtf memo fields .. i have always wanted to add the rtf menu and
toolbar, but never got round to it ...

see http://www.tdoc.org.uk/Ver5/QL_G_12.JPG

what our users like is to be able to see all the other related
data ... like who had it when in reply to what, how it fits into a
contract claim [e.g. keywords]

Richard
From: Nick Friend on
I agree really.... the problem is I'm constrained. The application is
already widely used, the customers expect to be able to use Word and
that can't be changed.

What I'm looking for are ways to improve it... speed and error
prevention basically. Not having had much experience with using Word
from VO I'm just nosing around at the moment to see what experiences
people have had and what suggestions or ideas might get thrown up. But
the one definite point is that Word has to stay as the editor, even if
not the viewer.

What I may look at is whether it's better to work via OLEAutoObject
and work with Word as an independent app... that might be sellable to
the customer base.

Nick


On 28 Apr, 12:17, "richard.townsendrose"
<richard.townsendr...(a)googlemail.com> wrote:
> Nick
>
> why use ms word ??? ... why not use RTF ...
>
> it has 99% of what people need ...
>
> we use rtf memo fields .. i have always wanted to add the rtf menu and
> toolbar, but never got round to it ...
>
> seehttp://www.tdoc.org.uk/Ver5/QL_G_12.JPG
>
> what our users like is to be able to see all the other related
> data ... like who had it when in reply to what, how it fits into a
> contract claim [e.g. keywords]
>
> Richard