Solved

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

Posted on 2004-07-30
8
1,223 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…

840 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