Usually I (probably as all) used agent approach in web applications for making excel's reports. In my case I was asked to make some reports exporting all data from current view (reports should look like in view).
So I decided to use another approach (in my case it was JSON because I like it more). Here you could download the demo version how to receive data from LN database.
to receive all documents from view I used:
to receive the name/title of columns I used:
and in the end of the story I used next code to create excel report
var xlApp = new ActiveXObject("Excel.Application");
xlBook = xlApp.Workbooks.Add();
var XlSheet = xlBook.activeSheet;
XlSheet.cells(1,1).value = "value";
xlApp.visible = true;
This function works only in IE as far as I know.