Ask the Expert

Export a search result view from Excel

How can I export a search result view from Excel (on the Web and with a LotusScript agent)?
Have a look at the method described at codestore.net, Keeping the boss happy. Basically you need an agent to write back the results to the Web user in a way that makes your browser recognize that it is an Excel file.
Print |Content-Type:
application/vnd.ms-excel|
Print |<table border="1">
<tr><td width="80">Document titles
</td><td>document authors</td>
</tr>
<tr><td>title number one</td>
<td>author number one</td></tr>
<tr><td>title number two</td>
<td>author number two</td></tr>
</table>|

If you access an agent containing this code (from a browser using http://server/database.nsf/searchagentname?openagent), it will open up Excel displaying three rows and two columns.

So, what you need to do is have a Web-enabled form with a query field and a submit button. Put an agent name in the webquerysave event of the form. Let the agent access session.DocumentContext, and from there access the field containing the query. Do an ftsearch and then loop through the resulting documents, printing a new line containing something like this for each document:

Print |<tr><td>| & loopducment.
subject(0) & 
|</td><td>| & loopdocument.
authors(0) & |</td></tr>|

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in November 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: