In my business web site, I have array with datas and I want a way to publish it in severeal format.
To achieve this, it exists the Grails export plugin.Here is what you will have under your array :
This tutorial will explain how to quickly use the export plugin and problems I met.
To install, the plugin I added in BuildConfig.groovy :
If you don't add, the Maven Repositories, you will have this error :
Resolve error obtaining dependencies: Could not find artifact org.odftoolkit:odfdom-java:jar:0.8.5 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Modify your GSP
The export tag will display icons and the require will had required css.
If you clic on pdf button,
- You can put the export tag where you want in the GSP
- You can specify format you want :
Modify your controllerHere is my controller :
I had a Check domain class with 3 fields : machineName, fileName, confServerName.These fields will be display in the pdf
- I had some problem with params.format values.In my case, it was always null and I don't know why.That's why my code is not exactly the same of the documentation
- You can also format text and adjust column size with formatters and parameters.See documentation for more details.
If you want more details about plugin installation, you could see the documentation : http://grails.org/plugin/export
Here is my Grails configuration :
- Grails 2.3.11
- Plugin ; runtime ":resources:1.2.1"