I assume what you want to do is take an attachment, get the contents of the attached file, and then put those contents elsewhere in the document or in another document.
That's easier said than done, but it IS doable. I don't have space in this response to give you a lot of code examples, but there are several in the Domino Developer's help and on notes.net (LDD). There's two basic ways of doing this, I'll call INTERNAL and EXTERNAL:
First, no matter which method we use to get the contents of the attached file, we will have to detatch it to the local hard drive, so use the NotesEmbeddedObject class in LotusScript to cycle through the files and save them to a place on the hard drive.
In this scenario, we use the built-in Notes Import routine to import the detatched file, either into the current document or another document. Just call the Import routine from the NotesUIDocument class, making sure the system caret is in the rich text field you want the data to go. You will need to know the type of file and filter you want to use, and all of those are listed in the Domino Designer documentation.
This scenario is a little more complex, but potentially has better results: In this scenario, you take the detatched file and open the appropriate application (Excel, Word, WordPro, WordPerfect, 123, etc), then, using OLE Automation, tell the host application to open the file, and then either embed the OLE object from the application into your rich text field (hard to do programmatically) or copy and paste the contents (which is nice and clean, but may give weird results, depending on the application).
Personally, I use the INTERNAL method most of the time, unless the import filter for the appropriate application just sucks or doesn't perform the import correctly (or at all). In that case, I go through the pain of using the EXTERNAL method.
Hope this helps!
This was first published in September 2002