• CSV - OpenOffice - Symphony

    By David Turner 1 decade ago

    I found this article in the CodeBin: Sample Access to OpenOffice or Lotus Symphony

     

    This got me thinking again that having MailMerge support for source files other than Microsoft/XLS, and being able to de-couple from the ActiveX/OLE requirement would be nice.

     

    Similar to as discussed previously on CSV Support, OpenOffice (ods), and Lotus Symphony support would probably not be terribly difficult to 'plug in' to this agent using the existing 'Spreadsheet' object API.

     

    Also requested by Paul - June 11 2012 on Sacha's site.

    Another useful link for Symphony here:   http://www.ibm.com/developerworks/lotus/library/symphony-toolkit

    • Implementation Hints

      By David Turner 1 decade ago

      Development notes on how to potentially implement this.

      Open the Create Mail Merge agent in Lotus Domino Designer.

       

      1) Take a copy of the MergeXLSpreadsheet class, paste it back in and rename it e.g. MergeSymphonySpreadsheet

       

      2) Make some changes to customise the class for your own requirements:

      The "New" subroutine should load the spreadsheet file from the provided filename and perform any other initialisation. Store the filename and any other state you require in object variables.

          %REM
              Constructor
              Description: Opens the specified filename as a spreadsheeet, accessing the active worksheet
          %END REM
          Public Sub New(strXLFilename As String, readOnly As Boolean)

          ...
          End Sub

       

      Implement the "LastDataRowNo", "CellText", to return the required values, and the "Delete" function to cleanup afterwards, the existing "FindTokens" function should work fine if the CellText function is implemented correctly.

          %REM
              Property Get CellText
              Description: For a worksheet row number and column number, the cell
                  text including formatting (first row/column is 1)
          %END REM
          Public Property Get CellText(rowNo As Long, colNo As Long) As String

          ...
          End Sub

          %REM
              Property Get LastDataRowNo
              Description: For the specified worksheet column number, derive the
              last row number which contains some data (first column is 1)
          %END REM
          Public Property Get LastDataRowNo(colNo As Long) As Long
          ...
          End Sub

          %REM
              Destructor
              Description: Cleanup variables, close open processes and file locks
          %END REM
          Sub Delete()

          ...
          End Sub

       

      3) Lastly, in the "Initialise" subroutine of the agent, modify the MergeXLSpreadsheet call to use your new class:

         'Open the excel workbook to the active sheet
          Dim xlSpreadSheet As New MergeXLSpreadsheet(strXLFilename, True)

       

      4) Test in your Lotus Notes client with 'Debug LotusScript' turned on and running the agent, add a breakpoint at this line and step through it.