Das Notes Forum
Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: seerow am 18.04.05 - 10:13:07
-
Hallo,
habe ein kleines problem mit einen rtitem. Ich habe in einem Formular ein rt Feld. Per Button will ich in den Feld eine Datei anhängen. Wenn ich das dok neu erstelle hängt er zwar immer die Datei an nur nicht in
das definierte Feld sondern ganz unten? ???
Sub Click(Source As Button)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim fileaufruf As String
Dim doc As NotesDocument
Dim nfo As Variant
Dim object As NotesEmbeddedObject
Dim rtitem As Variant
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
'--------------------------------------------------------------------------------------------------------
Set rtitem = doc.GetFirstItem( "uebergabe_doc" )
If rtitem Is Nothing Then
Set rtitem = New NotesRichTextItem( doc,"uebergabe_doc" )
End If
'--------------------------------------------------------------------------------------------------------
If ( rtitem.Type = RICHTEXT ) Then
o = rtitem.EmbeddedObjects
If Isarray (rtitem.EmbeddedObjects) Then
If ( o(0).Type = EMBED_ATTACHMENT ) Then
Msgbox "handover document allready exist, please press 'remove handover to add a new handover", 0 + 16, "handover document file allready exist"
End If
Else
fileaufruf = "all files (*.*)|*.*|IMS *.pdf files|*.pdf|IMS *.doc files|*.doc|"
nfo = ws.OpenFileDialog( False , "IMS handover document" , fileaufruf, "c:\", "" )
If Not Isempty( nfo ) Then
Set object = rtitem.EmbedObject( EMBED_ATTACHMENT, "", nfo(0) )
Else
Msgbox "no handover document attached", 0 + 64, "no handover attached"
End If
Call doc.Save( True, False, True )
Msgbox "handover document attached successfully", 0 + 64, "handover document attached"
End If
End If
End Sub
-
Ich denke, Du musst das UI Dokument schließen, die Datei ins das Backend-Dokument anhängen und dieses speichern und dann das UI Dokument wieder öffnen.
Also so:
Sub Click(Source As Button)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim fileaufruf As String
Dim doc As NotesDocument
Dim nfo As Variant
Dim object As NotesEmbeddedObject
Dim rtitem As Variant
Set db = s.CurrentDatabase
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Call uidoc.Save
Call uidoc.Close
'--------------------------------------------------------------------------------------------------------
Set rtitem = doc.GetFirstItem( "uebergabe_doc" )
If rtitem Is Nothing Then
Set rtitem = New NotesRichTextItem( doc,"uebergabe_doc" )
End If
'--------------------------------------------------------------------------------------------------------
If ( rtitem.Type = RICHTEXT ) Then
o = rtitem.EmbeddedObjects
If Isarray (rtitem.EmbeddedObjects) Then
If ( o(0).Type = EMBED_ATTACHMENT ) Then
Msgbox "handover document allready exist, please press 'remove handover to add a new handover", 0 + 16, "handover document file allready exist"
End If
Else
fileaufruf = "all files (*.*)|*.*|IMS *.pdf files|*.pdf|IMS *.doc files|*.doc|"
nfo = ws.OpenFileDialog( False , "IMS handover document" , fileaufruf, "c:\", "" )
If Not Isempty( nfo ) Then
Set object = rtitem.EmbedObject( EMBED_ATTACHMENT, "", nfo(0) )
Else
Msgbox "no handover document attached", 0 + 64, "no handover attached"
End If
Call doc.Save( True, False, True )
Msgbox "handover document attached successfully", 0 + 64, "handover document attached"
End If
End If
Call ws.EditDocment( True, doc )
End Sub
-
jepp, das wars. Ich bring das aber auch immer wieder durcheinander mit den Front und Backend dokument.
Danke dir....
-
Hallo,
naja, so ganz klappt es bei mir nicht. Am ende wenn das Backend Dokument geschlossen werden soll, kommt die Frage, ob es gespeichert werden soll, das ist ziemlich lässtig.
Ich habe dies jetzt mit einem Zusätzlichen Feld verstecktem Feld gelöst "saveoptions" mit dem Wert "0". Ich denke aber nicht das das die lösung ist.
:Bernd
-
Doch. Das ist die Lösung.
Du speicherst das Dokument ab, setzt Saveoptions auf "0" und schließt das uidoc. Dann wird nicht nachgefragt und das Dokument ist dann ohne die Saveoptions gespeichert.
-daniel
Edit:
Es reicht wenn du dem BackendDoc mit doc.Saveoptions = "0" das Item zuweist. In der Maske brauchst du das versteckte Feld nicht.