Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: Peacemaker am 06.09.04 - 10:02:25

Titel: Excel sheets in Notes importieren / Form Frage
Beitrag von: Peacemaker am 06.09.04 - 10:02:25
Hallo,

heute kurz und kompakt 2 Fragen:

1. Eine Excel Geschichte:

ich habe mir zu diesem Thema das folgende Script von

 http://www-10.lotus.com/ldd/sandbox.nsf/ecc552f1ab6e46e4852568a90055c4cd/5a58355f6caea82b85256c95006b44a4?OpenDocument&Highlight=0,excel

heruntergeladen. Es funktioniert nicht, da es nur bis Win2000 arbeitet.

kennt ihr ein anderes ähnlich strukturiertes Script das es ermöglicht auf knopfdruck *.xls Dateien zu importieren. (auch unter XP)


2. Eine Link auf Form Frage:

Ich habe auf einer Page vor, direkt auf ein bestimmtes Form zu verlinken, das bereits in der DB existiert. hab mal irgendwo gehört das das über die Document ID möglich ist?!? Aber wie stellt mann das am besten an? Wo muss der Link dann konkret gesetzt werden?
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: klaussal am 06.09.04 - 10:06:31
zu 1) sieh mal bei www.eknori.de nach
zu 2) dokument als verknüpfung kopieren, auf der seiten einen hotspot erstellen und dann die verknüpfung dort hinterlegen.
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: Peacemaker am 06.09.04 - 10:21:19
danke für die flotte Antwort, Thema 2 hat sich erledigt.

Zum 1, die Seite ist extrem unübersichtlich und auch längere Suche hat nix ergeben. Wo finde ich da die von dir gemeinten Informationen? Gib es noch alternative Scripts die den Denst tun?
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: koehlerbv am 06.09.04 - 10:25:21
Wieso sollte der Code aus der Sandbox nicht unter XP laufen ? Ggf. musst Du nur Bezug auf die eingesetzte Excel-Version nehmen - dazu gibt es in der Diskussion zur DB in der Sandbox schon einen Hinweis.

Bernhard
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: Peacemaker am 06.09.04 - 10:32:07
irgendwie ist das sandbox teil bei mir verhext. Habe 2 rechner, 1 xp , 1 win2000. auf dem XP läuft nix. Bei dem Win2000er sagt er nur - "check file or form or view"  - die sind aber alle ok
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: klaussal am 06.09.04 - 10:43:05
vielleicht klappt's hiermit:

Sub Click(Source As Button)
   
'The action button is located on a view
   Dim ws As New NotesUIWorkspace
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Set db = session.CurrentDatabase
   Dim view As NotesView
   Dim doc As NotesDocument
   Dim temp1 As String
   Dim temp2 As String
   ...
   Dim temp14 As String
   
   Dim xlApp As Variant
   Dim xlSheet As Variant
   Dim cursor As Integer
   Dim recordcheck As String
   
   On Error Goto ERRORLABEL
   Dim FileName As String
   Dim DefaultFileName As String
   DefaultFileName="D:\parkbw\ABC Schwerb..xls"
   
   NamePrompt$="Enter the complete Path and File Name of the Excel file to be imported:" &Chr(13)
   FileName=Inputbox(NamePrompt$,"Import File Name Specification",DefaultFileName,100,100)
   If FileName="" Then Exit Sub
     'Create an Excel object for the spreadsheet
     'It may be necessary to have the proper MS Office DLLs installed on the PC running this application
     'That is, the person must be able to open the XLS file with Excel
   Set xlApp = CreateObject("excel.Application")
   xlApp.Application.Workbooks.Open Filename
'File not found will return ERR=213 and the routine will be ended
   With xlApp.workbooks.Add
     'Not sure what this line is for, unless it's to be sure that at least one workbook is present in the XLS file
   End With
'Stop
   Set xlSheet = xlApp.Workbooks(1).Worksheets(1)
   recordcheck="x"
   r=1 ' Row counter - first row contains fieldnames from the database;
'these fieldnames are not needed as long as the spreadsheet follows a specified format
   While recordcheck <>"ENDE"
           'Recordcheck = "0" when there is no value in the first cell of the row,  if integer, or "", if string
           'Important - Set r to a value that will stop the import routine without missing any data, if the other criteria do not
'For this example, six columns are imported
      cursor=0
      r=r+1
      temp1=xlSheet.Cells(r,1).value
      recordcheck=Cstr(temp1)
      If recordcheck="0" Then Goto Finished ' Avoid generating empty record
      
      temp2=xlSheet.Cells(r,2).value
      temp3=xlSheet.Cells(r,3).value
      temp4=xlSheet.Cells(r,4).value
      ....
      temp14 =xlSheet.Cells(r,14).value
      
           'The above lines lines could be combined with those below, but keep separate for ease in debugging until ready to finalize the code
      Set doc = New NotesDocument(db)
      doc.Form = "parkbewilligung"
      doc.name= temp2
      doc.vorname = temp3
      ....
      doc.sonstiges = temp13
      
      Call Doc.Save(True, False)
Finished:
   Wend
   Goto SubClose
   
ERRORLABEL:
     'Msgbox "An error was encountered."
     'Print "Error: " Error(), "   Err:" Err(), " Erl:" Erl()
   If Err=213 Then
      Messagebox Filename & " was not found. Verify Path and Filename, then try the Import again."
      Exit Sub
   Else
      Messagebox "Error" & Str(Err) & ": " & Error$
   End If
   Resume Next
SubClose:
   xlApp.activeworkbook.close
   xlApp.Quit
   Set xlapp = Nothing
   Set view=db.getview("alle_nach_namen")
   Call ws.viewrefresh
   
End Sub
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: koehlerbv am 06.09.04 - 18:13:35
irgendwie ist das sandbox teil bei mir verhext. Habe 2 rechner, 1 xp , 1 win2000. auf dem XP läuft nix. Bei dem Win2000er sagt er nur - "check file or form or view"  - die sind aber alle ok

Nun solltest Du mal den Debugger bemühen und schauen, wo das Programm aussteigt, sonst stocherst Du absolut im Nebel. Die üblichen Routinen, die Excel als OLE-Server hernehmen, sind vom Betriebssystem nicht abhängig, bestenfalls von der Excel-Version.

Bernhard
Titel: Re:Excel sheets in Notes importieren / Form Frage
Beitrag von: gfunkus am 07.09.04 - 08:24:52
Also ich habe vo einigen Monaten an einem Excel Import gearbeitet, welcher unter Windows XP mit dem Office 2003 einwandfrei funktionierte. Es gibt allerdings bestimmte Office 2000 Versionen bei denen wir hier auch Probleme hatten. Also würde das ganze mal mit der 2003er Version testen.  8)