I agree with Paul.
Basically have a button to export the data. Then send them to a page that's an XAgent - re-get your data from whatever criteria and export from there. I've not used Apache POI yet but there are examples of exporting to Excel the html way on index.notesin9.com as well as cheatsheet.notesin9.com. The cheatsheet site should have a downloadable nsf with an export example.
Dave