|
I was looking through an older application I have and came across this technique. I don't claim to have invented it, but I want to pass it along as, after a quick Googling, I couldn't find mention of it. It is both easy to setup and maintain and it works without an agent.
This technique exports a view to Excel via a browser using only three items: the view itself, a Page design element, and a URL.
View Setup 1. Create a new view. 2. in the view properties, click the box for "Treat view contents as HTML" 3. Add the data columns. a. Format the column header text with table header HTML tags, e.g. "<th>Column Head</th>". Since the column heads will be grouped as a row, add "<tr>" to the beginning of the first column header text and "</tr>" to the end of the final column header text. b. Format the column values with HTML tags, e.g., "<td>" + fieldvalue + "<td>. You may want to place the value within an @Text formula, e.g. @Text(fieldvalue), to mitigate data export issues. Since each view entry will be treated as a row, add "<tr>" to
the beginning of the first column value and "</tr>" to the
end of the final column value. By the way, I like to align rows to the top, so use "<tr valign='top'>" at the beginning. 4. Save the view.
Page Setup 1. Create a new page. 2. In the page properties, change the Web Access Content Type to "Other" and enter "application/vnd.ms-excel" (no quotes) in the box. 3. On the page, type "<table>", enter a carriage return, then type "</table>" (again, no quotes). 4. Add an embedded view on the empty line between the table tags. Select the view above as the source. I change the default line value to 1000 to make sure I get everything. 5. You can add a title without needing to know the number of columns by adding "<p><b>Title</b></p>" (no quotes) above the table tag. 6. Save the page with a browser-friendly name (i.e. no spaces or special characters) and a ".xls" extension for Excel. You're ready to go!
URL To open the spreadsheet, call the page with with a standard Domino URL, e.g., "http://www.acme.com/dbpath/dbname.nsf/excelpage.xls".
Caveats * I have not used this with a huge number of either columns or rows, so you may run into some limits if you do. * I wouldn't recommend using this technique if you need to create a lot of spreadsheets, since each view index adds to the database size.
|
Ratings
0
|