Zusammenarbeit Notes und (integriertes) Symphony • Stand 14.02.2011 Inhalt von Track 3 – Session 4 Schnittstellen zwischen Lotus Notes und Microsoft Office zu schreiben ist mittlerweile Alltag. Die Integration von OpenOffice mit Notes war der nächste Meilenstein auf der Integrationslinie. Das integrierte Symphony bietet nun die Möglichkeit, Office-Anwendungen ohne Dritt-Anwendungen in Lotus Notes zu integrieren. Welche Möglichkeiten dabei bestehen, was technisch umsetzbar ist und wo die Grenzen liegen soll am Beispiel eines aktuellen Projekts gezeigt werden. Die Session basiert auf Lotus Notes 8.5.2 und Symphony 3.0 EN. Nutzung von Symphony • als Office Anwendung (Texte, Tabellen, Präsentationen) • in Verknüpfung mit Lotus Notes Funktionalitäten – • als Anwendungsplattform – • von Lotus Notes via Java oder Lotusscript auf Symphonie zugreifen Verbindung zu Anwendungen über die Symphonie JAVA API (bspw. Quickr) als Editor-Komponente in Anwendungen – integriert als RCP-Komponente • als Konvertierungsmodul für Textformate • in Verbindung mit VBA Funktionalitäten Schnittstellen • Lotus Symphony LotusScript API – – – • Document Presentation Spreadsheet Lotus Symphony Java API / UNO (Universal Network Objects) API (http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Introduction) • Visual Basic for Applications API (http://www-10.lotus.com/ldd/lswiki.nsf/dx/Lotus_Symphony_VBA_API_documentation) – – – – Visual Basic Runtime Library (128 methods) Microsoft Forms Object Model (input boxes, user forms) Microsoft Office Object Model (file dialog, command bars) Microsoft Excel Object Model (application, workbook, worksheet, name, windows, style, range, charts, pivottables, ..) LotusScript API - Dokumente LotusScript API – Dokumente Beispiel: Hello World %INCLUDE "symphonylsx.lss" Sub Click(Source As Button) Dim symApplication As new SymphonyApplication Dim symDocuments As SymphonyDocuments Dim symDocument As SymphonyDocument Dim symRange As SymphonyTextRange Set symDocuments = symApplication .Documents Set symDocument = symDocuments .AddDocument("",True,True) Set symRange = symDocument .content.End Call symRange .InsertBefore("Hello World") End Sub LotusScript API – Dokumente Beispiel: Briefkopf erstellen aus Kontakt - 1 %INCLUDE "symphonylsx.lss" Sub Click(Source As Button) Dim Dim Dim Dim Dim Dim Dim Set Set Set Set notesSession As New Notessession symApplication As New SymphonyApplication symDocuments As SymphonyDocuments symDocument As SymphonyDocument symRange As SymphonyTextRange notesDoc As NotesDocument i As Long notesDoc = NotesSession.currentdatabase.unprocesseddocuments.Getfirstdocument() symDocuments = symApplication .Documents symDocument = symDocuments .AddDocument("",True,True) symRange = symDocument.content.End For i= 1 To 6 Call symRange.InsertBreak(symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH) Next LotusScript API – Dokumente Beispiel: Briefkopf erstellen aus Kontakt - 2 symRange.Insertafter(notesDoc.CompanyName(0)) symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symRange.Insertafter(notesDoc.Fullname(0)) symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symRange.Insertafter(notesDoc.OfficeStreetAddress(0)) symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symDocument.content.End.Font.Bold = True symRange.Insertafter(notesDoc.OfficeZip(0) + " " + notesDoc.OfficeCity(0)) symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symDocument.content.End.Font.Bold = False symDocument.content.End.Horialignment = SYMPHONY_TEXT_HORI_ALIGN_RIGHT symRange.Insertafter("Suhl, " + CStr(Today())) symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symRange.InsertBreak symRange.End, SYMPHONY_TEXT_BREAK_PARAGRAPH symDocument.content.End.Horialignment = SYMPHONY_TEXT_HORI_ALIGN_LEFT symRange.Insertafter("Sehr geehrte Damen und Herren") End Sub LotusScript API – Dokumente Beispiel: Bookmarks füllen %Include "symphonylsx.lss" Sub Initialize Dim notesSession As New Notessession Dim symApplication As New SymphonyApplication Dim symDocuments As SymphonyDocuments Dim symDocument As SymphonyDocument Dim symRange As SymphonyTextRange Dim notesDoc As NotesDocument Dim array As variant Dim i As Long Set notesDoc = NotesSession.currentdatabase.unprocesseddocuments.Getfirstdocument() Set symDocuments = symApplication .Documents Set symDocument = symDocuments .AddDocument("t:\2011\entwicklercamp\Symphony\vorlage1.ott",True,True) LotusScript API – Dokumente Beispiel: Bookmarks füllen ReplaceBookMark symDocument,1,notesDoc.Fullname(0) ReplaceBookMark symDocument,2,notesDoc.OfficeStreetAddress(0) ReplaceBookMark symDocument,4,notesDoc.OfficeZip(0) + " " + notesDoc.OfficeCity(0) ReplaceBookMark symDocument,5,"Suhl, " + CStr(Today()) End Sub Sub ReplaceBookMark (doc As Symphonydocument, Mark As Integer,S As String) Dim symBookmark As Symphonybookmark Dim symRange As SymphonyTextRange Set symBookmark = doc.Bookmarks.item(1) Set symRange = symBookmark.Range symRange.insertbefore(S) End Sub LotusScript API - Presentation LotusScript API – Presentation Beispiel: Hello World %INCLUDE "symphonylsx.lss" Sub Click(Source As Button) Dim symApplication As New SymphonyApplication Dim symPresentations As Symphonypresentations Dim symPresentation As Symphonypresentation Dim symPage as SymphonyPage Dim symShape as SymphonyShape Set symPresentations = symApplication.Presentations Set symPresentation = symPresentations.Addpresentation("",True,True) Set symPage = symPresentation.Pages.Add(1) Set symShape = symPage.Shapes.Add(1) symShape.Text = „Hello World“ End Sub LotusScript API - Spreadsheets LotusScript API – Spreadsheets Beispiel: Hello World %INCLUDE "symphonylsx.lss" Sub Click(Source As Button) Dim symApplication As New SymphonyApplication Dim symSpreadSheet As Symphonyspreadsheet Dim symSheet As Symphonysheet Set symSpreadSheet = symApplication.Spreadsheets.Addspreadsheet("",True,True) Set symSheet = symSpreadSheet.Activesheet symSheet.Name = "Sheet" symSheet.Cells(1,1).Text = "Hello World„ End Sub LotusScript API - Dokumente Java API - Dokumente Java API – Dokumente Beispiel: Hello World import com.ibm.symphony.javaapi.Application; import com.ibm.symphony.javaapi.document.Document; import com.ibm.symphony.javaapi.document.Documents; public class DocumentsExample { public void example() { try { Application application = Application.getInstance(); Documents documents = application.getDocuments(); Document doc = documents.addDocument("", true, true); TextRange range = doc.getParagraphs().item(1).getRange(); range.insertAfter(„Hello World"); } catch (Exception e) { e.printStackTrace(); } } } Java API - Presentation Java API – Presentation Beispiel: Hello World import import import import import import com.ibm.symphony.javaapi.Application; com.ibm.symphony.javaapi.Constant; com.ibm.symphony.javaapi.SymphonyDocument; com.ibm.symphony.javaapi.presentation.Presentation; com.ibm.symphony.javaapi.presentation.Shapes; com.ibm.symphony.javaapi.presentation.TextShape; public class PresentationExample { public void example() { try { Application application = Application.getInstance(); Presentations presentations = application.getPresentations(); Presentation presentation = presentations.addPresentation("", false, true); Pages pages = presentation .getPages(); Page page = pages.item(1); Shapes shapes = page.getShapes(); TextShape shape = shapes. shapes.addShape(0, 100, 100, 3000, 300); shape.setName(„Hello World"); } catch (Exception e) { e.printStackTrace(); } } } Java API - Spreadsheets Java API – Spreadsheet Beispiel: Hello World import com.ibm.symphony.javaapi.Application; import com.ibm.symphony.javaapi.spreadsheet.Sheet; import com.ibm.symphony.javaapi.spreadsheet.Sheets; import com.ibm.symphony.javaapi.spreadsheet.Spreadsheet; import com.ibm.symphony.javaapi.spreadsheet.Spreadsheets; public class SpreadSheetExample { public void example() { try { Application application = Application.getInstance(); Spreadsheets spreadsheets = application.getSpreadsheets(); Spreadsheet spreadsheet = spreadsheets.addSpreadsheet("", true,true); Sheets sheets = spreadsheet.getSheets(); sheets.addTo(sheets.item(1), 1, true); Sheet sheet = sheets.item(1); Range range = sheet.range("A1:A1"); range.setText(„Hello World"); } catch (Exception e) { e.printStackTrace(); } } } Quellen • • • • Lotus Symphony Developers Guide for Notes diverse IBM Sites John D. Head openntf.org Links (1) • Symphony Homepage http://symphony.lotus.com/ • IBM Lotus Symphony wiki http://www-10.lotus.com/ldd/lswiki.nsf • Lotus Symphony VBA API documentation http://www-10.lotus.com/ldd/lswiki.nsf/dx/Lotus_Symphony_VBA_API_documentation • Neu in Version 3 http://www-10.lotus.com/ldd/lswiki.nsf/dx/Whats_new_in_Lotus_Symphony_3_LS3 • Java UNO Dokumentation http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Professional_UNO • Lotus Symphony Produkt Download https://www14.software.ibm.com/webapp/iwm/web/acceptSignup.do?source=swgnormandy&S_PKG=win_en2&S_TACT=104CBW71&lang=en_US&cp=UTF-8&& Links (2) • Lotus Symphony LotusScript API als Passport Advantage oder Partner Download • Lotus Symphony Developer Toolkit http://www14.software.ibm.com/webapp/download/preconfig.jsp?id=2010-10-19+16%3A31%3A30.441125R&S_TACT=&S_CMP= TS Consulting • Gibt es seit 1991 mit Erfahrungen in – Beratung, Betreuung, Projektdurchführung, Entwicklung, Administration – Fachknowhow in den Bereichen IT und TK, Fördermittel, Zertifizierung, Datenschutz, Fertigung, Konstruktion, Banken, Versicherung • ich arbeite je nach Bedarf genau mit den richtigen Partnern wenn es „in die Tiefe“ geht TS Consulting • Thomas Schneider – – – – Schneekopfstraße 9, 98528 Suhl 0176-64347223 [email protected] www.t-s-consulting.net