Let's Use the Same Example You Have A View, Column 1 IS Categorized, Column 2 and 3 Are Totals. In The Spreadsheet, Columns D and e Will Be Computed.
To make things easy, let's do this in an agent. So the URL will be .... agentName? OpenAgent. The simplest way to create a spreadsheet is to send an HTML table directly to Excel in your agent. This is done by setting The Content Type in your agent. The content type will send the information directly to excel. here's an example:
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim excel As Variant Dim worksheet As Variant Dim cell As Variant Dim view As NotesView Dim nav As NotesViewNavigator Dim entry As NotesViewEntry Dim rowNum As Integer Print {Content-Type: application / vnd.ms -excel} print {
} print {} print {
} Print {
Conference b> td>} print {
Home Wins b> td>} print {
Home win% b>
} print {
cumulative win% < / B> td>} print { tr>}
The Content Type of
application / vnd.ms-excel tells the browser to use Excel. Then we simply build a table. The first row, we set the column widths and put the headers in bold. (Last week we set the column widths and made the headers bold After Everything else Was Done). The Same Variables Will Be Needed this time.
rowNum = 2 'Current row of data' Get a NotesViewNavigator from our view Set db = session.CurrentDatabase Set view = db.GetView ( "vwByConference") Set nav = view.CreateViewNav Set entry = nav.GetFirstThis is the same as last week - setting up the view navigator.
'Go Through all the entries in the view while not entry is nothing print {
This is a little different than last week. This time, we are printing out HTML that will end up being the cell values. Columns A, B, and C are straightforward. For columns D and E, we want to create a formula. That's Why We Start Out The Cell Data with The Equals Sign. Then It's The formula, in The Same Way You Would Type It in To Excel. So, For Row # 4, The Value in Column D Will BE
= B4 / (B4 C4). Again, for the "cumulative" Row, The Sum is Computed from Row 2 THROUGH The CURRENT ROW.
Print " Table> body> html>" End Sub
Since all the formatting was done in The first row of the table, nothing more is needed