Q

Import a picture into a document, not as a link

Can LotusScript be used to import a picture into a document so that when the document is opened you see the both the picture (not just a link) and the other information on the document?

Of course! Here's a snippet:

Dim nudCurrent As NotesUIDocument
Dim sFilename As String
Dim iTempCount As Long
Dim sTemp As String
Dim sFileExtension As String
Dim wsCurrent As New NotesUIWorkspace
Set nudCurrent = wsCurrent.CurrentDocument

sFilepath = Input$("Enter the file path:")
sFilename = Input$("Enter the filename to import:")
'Get extension
If Instr(sFilename, ".") > 0 Then
	iTempCount = 1
	sTemp = Right$(sFilename, iTempCount)
	While Left$(sTemp, 1) <> "."
		iTempCount = iTempCount + 1
		sTemp = Right$(sFilename, iTempCount)
	Wend
	sFileExtension = Right$(sFilename, iTempCount - 1)
Else 
	sFileExtension = ""
	iTempCount = 0
End If
sFileExtension = Ucase$(sFileExtension)
If (sFileExtension = "JPG" Or sFileExtension = "GIF" Or sFileExtension = "CGM" Or sFileExtension = "BMP") Then
	Call nudCurrent.GotoField("Body") ?a RT Field
	Select Case sFileExtension
	Case "JPG":
		sFiletype = "JPEG Image"
	Case "GIF":
		sFiletype = "GIF Image"
	Case "CGM":
		sFiletype = "ANSI Metafile"
	Case "BMP":
		sFiletype = "BMP Image"
	Case Else
		sFileType = "ASCII Text"
	End Select
	Call nudCurrent.Import(sFiletype, sFilepath & "\" & sFilename)

As you can see the hard part is getting the file name and type.


This was first published in April 2002

Dig deeper on LotusScript

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close