Getting the contents from an attachment into another document
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:



Download: IT Certifications 101
Inside this exclusive essential guide, our independent experts break down which IT certifications are worth your time and effort, and how to get started obtaining them to further your career— including specific certifications that any cloud or desktop pro should seriously consider.
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.
COMMON:
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.
INTERNAL:
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.
EXTERNAL:
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!
Todd
Dig Deeper on Domino Resources
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.
Meet all of our Domino experts
View all Domino questions and answers
Start the conversation
0 comments