Code for exporting data from notes documents to an excel sheet and show it in html form of excel sheet:
Sub Initialize
On Error Goto GenErr
Print "content-type: Application/msexcel"
Print "Content-Disposition: attachment; filename=Report1.xls"
Print "<html>"
Print "<table border=0>"
Print "<tr><td colspan=5><center>"
Print "<b><span id='RptHead'> Report For Test</span></b>"
Print "</center></td></tr>"
Print "</table>"
Dim LOSession As New NotesSession
Dim LOVw As NotesView
Dim LODb As NotesDatabase
Dim LODoc As notesdocument
Dim LTDate As String
Dim LVNo As Variant
Set LODoc = LOSession.DocumentContext
'LTDate=LODoc.Query(0)
Set LODb=LOSession.CurrentDatabase
Set LOVw = LODb.GetView( "vwExcel" )
Set LODoc = LOVw.GetFirstDocument
Print "<table border=2 bordercolor=Black>"
Print "<tr>"
Print "<td>Sl No </td>"
Print "<td> Initiators</td>"
Print "<td>KLID </td>"
Print "<td>SBU </td>"
Print "<td>Project Short Name </td>"
Print "<td>Product Group </td>"
Print "<td>Product </td>"
Print "<td>Function </td>"
Print "<td>LOB </td>"
Print "<td>Rating by Experts </td>"
Print "<td>Project Manager </td>"
Print "<td>Proposal Manager </td>"
Print "<td>Process Area </td>"
Print "<td>Process Item </td>"
Print "<td>Key Learning Title</td>"
Print "<td>Problem Description </td>"
Print "<td>Analysis </td>"
Print "<td>Solution Adopted </td>"
Print "<td>Learnings </td>"
Print "<td>Implication </td>"
Print "<td>DO's List</td>"
Print "<td>DONOT's List </td>"
Print "<td>References </td>"
Print "<td>Approver </td>"
Print "<td>Comments </td>"
Print "</tr>"
Print "<tr>"
Print "</tr>"
j=1
While Not ( LODoc Is Nothing )
Print "<tr>"
Dim LVTemp As Variant
Print "<td>" & j &"</td>"
For i=0 To 23
'LVTemp = LODoc.ColumnValues( i )
'Msgbox LVTemp
'Print "<td>" & LVTemp & "</td>"
Print "<td>" & LODoc.ColumnValues( i ) & "</td>"
Next
Print "</tr>"
j=j+1
Set LODoc = LOVw.GetNextDocument( LODoc )
Wend
Print "</table>"
Exit Sub
GenErr:
Msgbox "Error on SaveKtips agent , Error On line " & Erl & " Error is " & Error & " Err is " & Err
Exit Sub
End Sub
Sub Initialize
On Error Goto GenErr
Print "content-type: Application/msexcel"
Print "Content-Disposition: attachment; filename=Report1.xls"
Print "<html>"
Print "<table border=0>"
Print "<tr><td colspan=5><center>"
Print "<b><span id='RptHead'> Report For Test</span></b>"
Print "</center></td></tr>"
Print "</table>"
Dim LOSession As New NotesSession
Dim LOVw As NotesView
Dim LODb As NotesDatabase
Dim LODoc As notesdocument
Dim LTDate As String
Dim LVNo As Variant
Set LODoc = LOSession.DocumentContext
'LTDate=LODoc.Query(0)
Set LODb=LOSession.CurrentDatabase
Set LOVw = LODb.GetView( "vwExcel" )
Set LODoc = LOVw.GetFirstDocument
Print "<table border=2 bordercolor=Black>"
Print "<tr>"
Print "<td>Sl No </td>"
Print "<td> Initiators</td>"
Print "<td>KLID </td>"
Print "<td>SBU </td>"
Print "<td>Project Short Name </td>"
Print "<td>Product Group </td>"
Print "<td>Product </td>"
Print "<td>Function </td>"
Print "<td>LOB </td>"
Print "<td>Rating by Experts </td>"
Print "<td>Project Manager </td>"
Print "<td>Proposal Manager </td>"
Print "<td>Process Area </td>"
Print "<td>Process Item </td>"
Print "<td>Key Learning Title</td>"
Print "<td>Problem Description </td>"
Print "<td>Analysis </td>"
Print "<td>Solution Adopted </td>"
Print "<td>Learnings </td>"
Print "<td>Implication </td>"
Print "<td>DO's List</td>"
Print "<td>DONOT's List </td>"
Print "<td>References </td>"
Print "<td>Approver </td>"
Print "<td>Comments </td>"
Print "</tr>"
Print "<tr>"
Print "</tr>"
j=1
While Not ( LODoc Is Nothing )
Print "<tr>"
Dim LVTemp As Variant
Print "<td>" & j &"</td>"
For i=0 To 23
'LVTemp = LODoc.ColumnValues( i )
'Msgbox LVTemp
'Print "<td>" & LVTemp & "</td>"
Print "<td>" & LODoc.ColumnValues( i ) & "</td>"
Next
Print "</tr>"
j=j+1
Set LODoc = LOVw.GetNextDocument( LODoc )
Wend
Print "</table>"
Exit Sub
GenErr:
Msgbox "Error on SaveKtips agent , Error On line " & Erl & " Error is " & Error & " Err is " & Err
Exit Sub
End Sub