Link to home
Start Free TrialLog in
Avatar of bkib
bkib

asked on

How does a document inherit the content of an embedded Object (OLE)

I have got a richtext field, in which i placed an embedded object. (excel-sheet, changes will be saved in the document). Now i have to create a new document, which take some contents of the marked document. That's no problem, but i don't get the content of the "excel-sheet". I only get the empty sheet. Is there any way to solve my problem?
Avatar of RanjeetRain
RanjeetRain

I assume you are talking about a client application.

You can write an agent to do so. Put a field containing the Universal ID in the original document from which you want to inherit. In the agent, using the universal ID of the parent document, get the document and the embedded object in it, save it to a temporary file and attach it to the current document.

Hope I was clear.
You are embedding the object ina  richtext field right, do you have the same richtext field name in the response document(or the inherited document)?

Partha
OLE object doesn't get inherited !

You have to copy the ole object..get the handle of the ole object in the selected document and embed it into the new doc's rich text.. this can be done during queryopen of the form..

~Hemanth
Hemantha,

You and I are saying essentially the same thing, right ;-)
Most likely, when you are trying to get sheet content, you have used non-active Excel OLE object.

Try to add code:  call Sheet.Activate or Sheet.Active = true. I dont remember exact code, but the problem is hereabout.

Better, post here your LS code where you open excel-sheet.
Avatar of bkib

ASKER

I forgot an important detail. the object is embedded in the form, not in document, so everybody works with the same formatted sheet.  i tried your tips but i don't get the object neither the objectarray:
Set db=session.currentdatabase
Set col=db.unprocesseddocuments
Set doc=col.getfirstdocument
Set item=doc.getfirstitem("Name")
notesEmbeddedObjectArray = item.EmbeddedObjects 'this doesn't works
If item.Type = RICHTEXT Then
 Set object= item.getembeddedobject("Microsoft Excel-Arbeitsblatt") ' object wasn't set
End If
What' wrong?
Do you open and save excel document after embedding it into form?

Try open it and save in your form in designer. Only after that embed object will be valid.
Avatar of bkib

ASKER

Hi Alexey
i did, but in LS the object is not set.
Since you said it is in the form,.. you have to access the embeddedobject using NoteDocument NOT richtext item.

ASKER CERTIFIED SOLUTION
Avatar of HemanthaKumar
HemanthaKumar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bkib

ASKER

ok, I understand hemanthaKumar that i have to do it in documents. I made an action, which embed the excel sheet as object in a richtextfield. With the tips from Alexey it works. I can see the items in Debugger with the object and so on. But I don't get the object in uidocument. Users won't see them and can't edit them.
????
you mean you can't see the embedded object ? Is the richtext field visible and is available on the document ? and did u save the doc after embedding ?
Avatar of bkib

ASKER

Yes, the richtextfield is visible, available, I saved the document, reloaded the uidocument. I've closed it, nevertheless I couldn't see the object after opening. How do I copy or embed the handle of an OLE object?
Avatar of bkib

ASKER

I've got it. I didn't use the right classes and methods. With Notesuidocument and "createobject" it works. Now my, let's hope, last question: In the document I let the object shown as "symbol", then when I open the object it is opened with all Excel functions. otherwise I don't have the menuebar and so on. Is there any possibility to give this property with script, so that the user don't have to do so?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bkib

ASKER

Now it works well. Thanks to HemanthaKumar and Alexey Zubkov. I will split the points.