Manage Learn to apply best practices and optimize your operations.

Set Fittowindow - Ole Objects

When you add ole-objects in a notesrich text item
p.e. MS-Word, you have the possibility to click on the object and set the
fittowindow check.

It's also possbible to do this by script (notes4.6.3 or higher).
Function SetFitItWindow(rtfFieldName As String)
Dim ses As New NotesSession
Dim db As notesdatabase
Dim view As notesview
Dim object As notesembeddedobject
Dim bdoc As notesdocument
Dim doc2 As Notesdocument
Dim col As NotesDocumentCollection
Dim docid As String
Dim w As New notesuiworkspace
Dim uiDoc As NotesuiDocument

Set uidoc = w.currentdocument
Set db = ses.currentdatabase

call uidoc.refresh

Set bdoc = uidoc.Document


Set rtItem = bdoc.GetFirstItem(rtfFieldName)
Set object1=rtItem.GetEmbeddedObject("Titledocument")

If object1 Is Nothing Then
SetFitItWindow = False
Exit Function
End If

object1.fittowindow = True


'Get the key value from the current document
tmpvariant = bdoc.universalid
Docid = bdoc.universalid

'Refresh the main view through back end and front end methods
' Create a view "DocId" with first column formula: @Text(@DocumentUniqueID )
Set view = db.getview("DocID")
If view Is Nothing Then
SetFitItWindow = False
Exit Function
End If

Call view.Refresh
Call w.viewrefresh

'Set save options to zero so that user does not get prompted to save after
closing uidoc
bdoc.saveoptions = "0"
Call uidoc.close

Set doc2 = view.GetDocumentByKey(docid)
Set uiDoc = w.EditDocument(True, doc2)

'Reset doc and set saveoptions back to "1"
Set bdoc = uidoc.document
bdoc.saveoptions = "1"
End If
End Function

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...