I'm developing a module. I need to give to the users the option to download the coupons in XLS (Excel) format.
How I can do this?
I'm developing a module. I need to give to the users the option to download the coupons in XLS (Excel) format.
How I can do this?
I'm assuming you are using some content type for the content needed on your module. If so, then you can use Views with a module like Views Data Export.
As an alternative to the Views Data Export module (suggested in another answer here), you could also use the Forena module to create an appropriate report, and then save (export) the report data (= query results) in the desired format, of which XLS is one of the supported options (apart from CSV, HTML, DOC, PDF, etc). For an online example of this, refer to the Customized Simple Table of States, and its related annotations to explain the example.
For somebody who rather wants/needs a JSON or XML format, refer to my answer to "How to add a link to the CSV download to my module page, for a report created with Forena?".
To integrate Forena in a custom module, use any of the hooks available to do so, as documented in Forena's Developers Guide.