logo

New Response

« Return to the main article

You are replying to:

  1. Summarized a couple items from this thread also added a "content-disposition" tag which will launch the file in Excel (not excel within the browser) - so you don't need to name your agent ".xls".

    This will work with any view - replace GetCGIParm("VIEW") with the name of the view you are using.

    Sub Initialize On Error Goto Handler Dim s as New NotesSession Dim db_Current as NotesDatabase Dim vw_Export As NotesView Dim nv As NotesViewNavigator Dim ne As NotesViewEntry Dim i_CurColumn As Integer Set db_Current = s.CurrentDatabase Set vw_Export = db_Current.GetView(GetCGIParm("VIEW")) Set nv = vw_Export.CreateViewNav Set ne = nv.GetFirst Print |Content-Type: application/vnd.ms-excel| Print |Content-disposition: attachment; filename=| & GetCGIParm("VIEW") & |.xls| Print |<table border="1">| Print |<tr>| Forall c In vw_Export.Columns If Not c.IsHidden Then Print |<td width="80"><b>| & c.Title & |</td>| End If End Forall Print |</tr> | While Not(ne Is Nothing) Print|<tr>| i_CurColumn = 0 Forall c In vw_Export.Columns If Not c.IsHidden Then If Not ne.IsCategory And c.IsHideDetail Then ' TOTAL COLUMN AND HIDE DETAIL - PRINT BLANK CELL Print |<td></td>| Elseif c.TimeDateFmt = 0 And Isdate(ne.ColumnValues(i_CurColumn)) Then ' FORMAT DATE ONLY COLUMNS Print |<td>| & Format$(ne.ColumnValues(i_CurColumn),"mm/dd/yy") & |</td>| Elseif Isarray(ne.ColumnValues(i_CurColumn)) Then ' FORMAT MULTI-VALUE COLUMNS Print |<td>| & Join(ne.ColumnValues(i_CurColumn),"<br>") |</td>| Else Print |<td>| & ne.ColumnValues(i_CurColumn) & |</td>| End If End If i_CurColumn = i_CurColumn + 1 End Forall Print |</tr> | Set ne = nv.GetNext( ne ) Wend Exit Sub Handler: Error Err, Error & { //} & Getthreadinfo(1) & {:} & Erl End Sub

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: