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?
bkibAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RanjeetRainCommented:
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.
0
p_parthaCommented:
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
0
HemanthaKumarCommented:
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
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

RanjeetRainCommented:
Hemantha,

You and I are saying essentially the same thing, right ;-)
0
Alexey_ZubkovCommented:
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.
0
bkibAuthor Commented:
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?
0
Alexey_ZubkovCommented:
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.
0
bkibAuthor Commented:
Hi Alexey
i did, but in LS the object is not set.
0
HemanthaKumarCommented:
Since you said it is in the form,.. you have to access the embeddedobject using NoteDocument NOT richtext item.

0
HemanthaKumarCommented:
And if it is on the form.. then what is that you are not inheriting... the changes made in a document ? Well you don't expect to.. as form will override the object...If it is on richtext item (and not on form) then you could use the script to copy the object
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alexey_ZubkovCommented:
Actually, there is an error in LS script.
Instead of
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

try
Dim eo as NotesEmbeddedObject
Set eo = doc.EmbeddedObjects(0)
Set object = eo.object

So, you have in variable "object" Excel OLE object, that you needed.
Then you may require call object.Activate
and then you can use this OLE object as you want.

Sorry, I didnt find one of my old databases where I make almost the same task with Excel object as yours, so I write code here from memory.
0
bkibAuthor Commented:
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.
????
0
HemanthaKumarCommented:
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 ?
0
bkibAuthor Commented:
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?
0
bkibAuthor Commented:
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?
0
HemanthaKumarCommented:
You can activate the object using Activate method of embeddedobject.. and doverb "Open"... Look into help for this functions

Or the form launch property can be set to launch the ole object inplace.
0
bkibAuthor Commented:
Now it works well. Thanks to HemanthaKumar and Alexey Zubkov. I will split the points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.