Since this forum is about XPages development: if you're indeed using them you might want to have a look at POI4XPages (http://poi4xpages.openntf.org/).
It can be configured (on an XPage) to load a template, insert the data and send the generated file back to the user.