Solved

How can I add a picture from a file to a rich-text item using LotusScript?

Posted on 2004-07-30
8
1,181 Views
Last Modified: 2013-12-18
I have a form with a hotspot action. When clicked, it will show an OpenFileDialog, so the user can select a picture file. When the user made his selection, I want the content of the file to be put into a hidden rich-text item with the name Logo. Is there a method to Import the file into the rich-text item? The existing Import method needs an open NotesUIDocument with the focus in the rich-text field, but I want to get the picture myself. In fact, the document is shown using a form in a DialogBox, hence rich-text fields cannot be used.

Here's what I tried:

Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim files As Variant
      Dim doc As NotesDocument
      Dim rtitem As Variant
      Dim eo As notesEmbeddedObject
      
      files= ws.openfiledialog(False, "Select picture file", "All pictures|*.jpg;*.jpeg;*.gif|JPEG|*.jpg;*.jpeg|GIF|*.gif|Bitmap (not recommended)|*.bmp|All files|*.*|")
      If Isempty(files) Then Exit Sub
      Set doc= ws.CurrentDocument.Document
      doc.LogoFile= files(0)
      Call doc.RemoveItem("Logo")
      Set rtitem= New NotesRichTextItem(doc,"Logo")
      Set eo= rtitem.EmbedObject( 1453, "", files(0))
End Sub

How to do this?
0
Comment
Question by:Sjef Bosman
8 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11677035
Using import method of NotesUIDoc is the only option I can think of



~Hemanth
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 11677370
Upgrade to R6, and use passtru html :-)

That's a solution that will work both on the web and in Notes...

Instead of embedding as object, you would embed it as attachment....

cheers,

Tom
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 11677620
Nice thought Tom, but it's supposed to be R5/R6 compatibut... Web doesn't support DialogBoxes anyway, so native Notes will do.

Importing can only be done in a focused rich-text field, which I don't have in a DialogBox. SOme explanation: I use a DialogBox to present the db's configuration. Looks awesome, 99% works, just this %$#%$# logo-file!

No tricks up your sleeves? No fiddling?  In the distance I can hear someone say "Midas"... No, native Notes please, API but no DLL, that's all too difficult.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 11677804
Sorry buddy, with this many restrictions I would say Lotus has to come up with this as a new enhancement
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 46

Author Comment

by:Sjef Bosman
ID: 11678037
They already have my long short-list. Maybe I should embed it as a Microsoft Paint object? Why do I always have to ask questions without a solution? No that's not a new question! I could do with some *sob* consolation...

But hey, the day ain't over yet :)
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 250 total points
ID: 11678071
Do you need to show the logo immediately?  If not, what you can do is on dialog box close bring it in.  If the dialog box does not return back to the same doc's form, then create a temporary document using a form that only has a rich text field, do the import, save and close, renderToRichTextItem, and delete the original.

Also, I've found that many dialog boxes do not really need to be dialog boxes.  You can open a new page that has a dialog box look and feel.
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 11678218
Pls explain:
- create temp. document, import, etc: would this mean that the user sees the Import flashing by on his screen?? not such a problem, I'd like your view.
- open a new page with dialogbox look&feel?? it is really a document, with lots of fields.

Me first:
- no, I don't have to show the logo, at all actually.
- I let the user select the filename from his pc and would like to have only the picture that's in the file in the RT-item.
- there is no document beneath the DialogBox! An agent calls the DialogBox with a doc-parameter, in the QueryClose the document gets saved ("is that possible?" "yes it is, looks great!").
- I already thought RenderTo... but your angle is new and interesting
0
 
LVL 46

Author Comment

by:Sjef Bosman
ID: 11685527
Q: Points are yours!

- screen flashes indeed, but it's a one-time-only exercise usually during installation
- I had to add a Sleep(1) in a loop to check for the saved document with the logo, before I can call RenderTo
- even the see-through gif-pictures come over nicely!

Thanks for the push.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now