Reputation: 514
I've looked at some plugins but no success. I tried Export Plugin 1.6 as well but the view doesn't recognize r:.. and export:.. tags. What is the best way to export rows of data from postgresql database into an excel file from a click of a button? Thank you.
Upvotes: 1
Views: 1816
Reputation: 1219
The export plugin is dependent on the resources plugin. You can add the resources plugin and try again. I use resources 1.2.8. Also you need to add this to your dependencies:
dependencies {
............
// Needed for the export plugin?
compile 'commons-beanutils:commons-beanutils:1.8.3'
plugins {
............
runtime ":resources:1.2.8"
Upvotes: 1
Reputation: 1036
Did you try directly with apache poi ?
From the website:
The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and OLE2 formats and welcome others to participate.
EDIT: Here is a tutorial: Read / Write Excel file in Java using Apache POI and a quick guide
EDIT2: I just found another link using Grails that could help you. The example use another library: jexcelapi
Upvotes: 1
Reputation: 11062
you could create a gsp which renders a .csv
-file and set the content-type
of the response to application/vnd.ms-excel
within the controller.
that's the easiest way, but you will not be able to control the format of cells.
Apache POI - as mentioned by Abincepto - is another solution which is more complex but gives you full control over the generated excel file
Upvotes: 2