Export a Generated Table to Excel

Export a Generated Table to Excel

  
Hello all,

I'm currently developing a screen in which I generate a table with a dynamic number of columns.. To generate such a table, I'm using an extension I found in this post.
I would like to hear ideas on how could I export such a table to an Excel file.

Thank you for your time,
Pedro
Hi Pedro,

Two thoughts come to my mind. First and foremost the post you mentioned is from 2009 and in that time it was not possible to include webblocks inside other widgets like tablerecords. This feature that was introduced in Platform version 5.0, if I'm not mistaken, allows you to build a much more managle dynamic table. You can use a webblock for the columns of a row and hence make it dynamic.

As to exporting your table I think you can export it directly, meaning that you can use the HttpBinaryGet from RichMail to retrieve the binary content of a webscreen containing your dynamic table and then use a download widget with excel content type ('application/excel'). I think this might do the trick, I know I0ve use this to export to word with good results.

Cheers,
André
Hello, André

First of all, thank you for your answer.

Despite the fact that an upgrade to 6.0 is planned, currently I'm using 4.2 and I don't have such feature available.

About the solution you proposed, the page that renders the dynamic table contains the filters to generate the table and other elements... However, the request to create the table is sent by "Ajax". Do you think that it would be possible to replicate the request with HTTPRequestHandler POSTRequest methods?
I have an alternate "non-elegant" solution that would be to copy the dynamic table to the user's clipboard and then he would paste it on the Excel.. But as I said, it's not an elegant method..

Thanks again,
Pedro
Hi Pedro,

It's rather difficult to fully understand you're example, but I don't see why you need the ajax call to achieve what you want. If you use this to speed up the response to the user I don't think you need to use the same solution to export the table. Can't you create a webscreen with the same table without the ajax call?

Your alternative solution to copy the table to the user's clipboard may be difficult to achieve since I think you'd need the client's acceptance for the application to use the clipboard.

If you can create this webscreen I think this post might help you.

Cheers,
André