Domino 9 und frühere Versionen > Entwicklung

Speichern unter in LS gesucht

(1/2) > >>

Don Pasquale:
Hallo Lotus-Fans,

in einer Anwendung möchte ich dem Benutzer die Möglickeit geben,
das angehängte Dokument ins FileSystem abzuspeichern.
Mit dem folgenden Code funktioniert das auch, ich suche aber mehr
einen komfortablen "Speichern unter" Dialog.
Vielleicht weiß ja jemand einen API Befehl ?

Ciao
Don Pasquale



   Dim workspace As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim session As New notessession
   Dim wk As New notesuiworkspace
   Dim folder As String
   
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.Document
   Set ritem=doc.getfirstitem("Body")
   
   
   If (ritem.type=RICHTEXT)Then
      If Isarray(ritem.embeddedobjects) Then
         Forall o In ritem.embeddedobjects
            If (o.type=EMBED_ATTACHMENT) Then
               
               folder = BrowseFolder (doc.CERT_Destination(0), "Wohin soll das Dokument gespeichert werden ?")
               Messagebox(folder)
               Call o.ExtractFile( folder  & "\" & o.Source & ".tif" )
            End If
         End Forall
      End If
   End If


Function BrowseFolder (path As String, windowtitle As String) As String
   
   Dim X As Long, bi As BROWSEINFO, dwIList As Long
   Dim wPos As Integer
   Dim cam2 As String
   
   bi.pszDisplayName = path
   bi.hOwner = hWndAccessApp
   bi.lpszTitle = title
   bi.ulFlags = BIF_RETURNONLYFSDIRS
   
   dwIList = SHBrowseForFolder (bi)
   cam2 = Space$(512)
   X = SHGetPathFromIDList(Byval dwIList, Byval cam2)
   
   If X Then
      wPos = Instr (cam2, Chr(0))
      BrowseFolder = Left$ (cam2, wPos - 1)
   Else
      BrowseFolder = ""
   End If
   
End Function

koehlerbv:
Wäre die Methode SaveFileDialog aus NotesUIWorkspace nicht besser geeignet ?

Bernhard

Don Pasquale:
Hmm,
wo Du recht hast, hast Du recht.

Wieso in die Ferne schweifen, sieh das Gute liegt so nah !

Ciao
Don Pasquale
ps: Ich hätte jetzt auch das mit dem Wald und den Bäumen,
aber heute mal was Anderes.

koehlerbv:
 ;)

Don Pasquale:
Hier nun in Kürze die Lösung:
Sollte im Dokument das Feld TITEL ausgefüllt sein,
so wird der TITEL und tif als Speichername vorgeschlagen
ansonsten der Name des Attachments.
Das StandardVerzeichnis sollte man sich aus dem Profildokument holen
Ciao
Don Pasquale

Sub Click(Source As Button)
   
   Dim workspace As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
   Dim doc As NotesDocument
   Dim session As New notessession
   Dim wk As New notesuiworkspace
   Dim folder As Variant
   Dim ritem As NotesRichtextItem
   Set uidoc = workspace.CurrentDocument
   Set doc = uidoc.Document
   Set ritem = doc.getfirstitem("Body")
   Dim StandardVerzeichnis As String
   
   StandardVerzeichnis = "C:\TEMP"
   
   If (ritem.type=RICHTEXT)Then
      If Isarray(ritem.embeddedobjects) Then
         Forall o In ritem.embeddedobjects
            If (o.type=EMBED_ATTACHMENT) Then
               If doc.titel(0) <> "" Then
                  folder = workspace.SaveFileDialog ( False, "Speichern unter ..",, StandardVerzeichnis , doc.Titel(0) & ".tif" )                  
               Else
                  folder = workspace.SaveFileDialog ( False, "Speichern unter ..",, StandardVerzeichnis , o.source & ".tif")                  
               End If
               Messagebox folder(0)
            End If
         End Forall
      End If
   End If
   
   
End Sub

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln