Discussion:
[ANN] Export plugin 0.7 released
Andreas Schmitt
2010-04-10 13:23:30 UTC
Permalink
Hi,

Export plugin 0.7 has been released. This plugin allows you to export
domain objects to CSV, Excel, ODS (Open Document Spreadsheet), RTF,
PDF and XML and can be extended to support additional formats.

Version 0.7 contains multiple bug fixes, enhanced formatter closures,
new parameters for PDF, RTF and XML export
and support for asian characters.

All formatter closures now take two arguments and offer access to the
domain object, e.g. to combine two attributes.
Existing formatter closures must be changed by adding the additional argument.

Previous versions

def date = { value ->
if(value instanceof Date){
return new java.text.SimpleDateFormat("dd.MM.yyyy").format(value)
}

return value
}

Version 0.7

def date = { domain, value ->
if(value instanceof Date){
return new java.text.SimpleDateFormat("dd.MM.yyyy").format(value)
}

return value
}

- PDF
- font.family (global font family setting)
- title.encoding (encoding for title font)
- header.encoding (encoding for header font)
- text.encoding (encoding for text font)
- pdf.encoding (global font encoding)
- column.widths (allows to set different column widths)
- RTF
- font.family (global font family setting)
- title.encoding (encoding for title font)
- header.encoding (encoding for header font)
- text.encoding (encoding for text font)
- rtf.encoding (global font encoding)
- column.widths (allows to set different column widths)
- XML
- xml.root (specify root element name)
- depth (depth for building tree affects how collections and
relationships are exported)

I would like to thank everybody for reporting bugs or suggesting improvements.

For further information check out http://www.grails.org/plugin/export

Best regards,
Andreas

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
inabramova
2010-06-29 19:33:07 UTC
Permalink
Hi,

Thank you for your plugin, it's been great!

I have few suggestions and I am wondering whether these features will be
available to the plugin users soon..

I am currently using the plugin to export a domain class with many nested
associations.. For example, I have a list of locations associated with an
object. I would very much like to be able to export a singe location, email
or website into it's own cell. But right now I am limited to stuffing all
the associated object into one cell (list of locations, list of emails etc..
) Are you planning to implement a solution to that?

Thanks for reading!

Irina
--
View this message in context: http://grails.1312388.n4.nabble.com/ANN-Export-plugin-0-7-released-tp1835347p2272635.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Andreas Schmitt
2010-07-07 12:26:42 UTC
Permalink
Hi Irina,

sorry for the delay. Do you mean wether nested associations e.g. "
locations.name" can be used as fields for export or
individual tables for asscociations? The former is already implemented, that
means you can specify "locations.name"
for example as field. I need to update the documentation concerning this
feature.

Best regards,
Andreas
Post by inabramova
Hi,
Thank you for your plugin, it's been great!
I have few suggestions and I am wondering whether these features will be
available to the plugin users soon..
I am currently using the plugin to export a domain class with many nested
associations.. For example, I have a list of locations associated with an
object. I would very much like to be able to export a singe location, email
or website into it's own cell. But right now I am limited to stuffing all
the associated object into one cell (list of locations, list of emails etc..
) Are you planning to implement a solution to that?
Thanks for reading!
Irina
--
http://grails.1312388.n4.nabble.com/ANN-Export-plugin-0-7-released-tp1835347p2272635.html
Post by inabramova
Sent from the Grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
http://xircles.codehaus.org/manage_email
inabramova
2010-07-07 16:46:25 UTC
Permalink
Hi Andreas!

My original question was about having a list of objects and trying to export
every associated object into it's own cell.
for example, I have an object with multiple locations, so I wanted to have a
resulting table look like the following: (in my domain class I specified
list of locations as "hasMany = [ locations : Location ] "

Name | Location 1 | Location 2 | Location 3 .. etc
-------------------------------------------------
| | |

I realized that using my list of domain objects I could create a new list of
map objects where each location would be mapped to it's own key (location1,
location2, location3..) That's what I did, and used my newly obtained map
for exporting. (Worked out very nice!)

Thanks for your reply, it's also nice to know that if I needed specific
fields from my associations, I can just specify them right away instead of
passing a formatter closure asking for those few fields.
--
View this message in context: http://grails.1312388.n4.nabble.com/ANN-Export-plugin-0-7-released-tp1835347p2281185.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
inabramova
2010-09-08 23:19:57 UTC
Permalink
Hi Matt. This is the approximate code I used..

def resultListWithExtraColumns = []

def maxLocationIndex=0;

resultList.each{it->
def expanded_record = ["name": it.name]
it?.locations.eachWithIndex{location, index->
expanded_record["location${index+1}"]=location
if ((index+1) > maxLocationIndex)
maxLocationIndex = index+1
}
resultListWithExtraColumns.add(expanded_record)
}

if (maxLocationIndex > 0){
for (i in 1..maxLocationIndex){
def location_field = "location${i}"
fields.add(location_field)
labels[(location_field)]= "Location ${i}"
formatters[(location_field)] = locationFormatter
}
}

//pass in the new list instead to the exportService
resultList = resultListWithExtraColumns

exportService.export(params.format, outputStream, resultList, fields,
labels, formatters, [:])
--
View this message in context: http://grails.1312388.n4.nabble.com/ANN-Export-plugin-0-7-released-tp1835347p2532176.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
cotrariello84
2014-06-10 10:32:19 UTC
Permalink
i have the some problem. in particular i have 4 domain classes

class A hasMany B
class B hasMany C
class C hasMany D

so if i want to use the same code i should only replace Person.list() with
A.list() ?


it's correct?

or what?



--
View this message in context: http://grails.1312388.n4.nabble.com/ANN-Export-plugin-0-7-released-tp1835347p4657092.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...