Solved

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

Posted on 2004-07-30
8
1,274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

  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…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

630 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