Solved

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

Posted on 2004-07-30
8
1,206 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Encrypted Mail message in a NSF 10 30
Email Message Background Color 4 133
Bulk lotus notes account creation 3 82
Counting documents in a Domino View 3 83
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

773 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