Improving CSV genertion

This commit is contained in:
Marc Ducobu 2015-02-26 19:03:14 +01:00
parent caffa5b30f
commit 3e6c929150
2 changed files with 6 additions and 5 deletions

View File

@ -192,7 +192,7 @@ class PersonController extends Controller
array( array(
'persons' => $persons, 'persons' => $persons,
'cf_group' => $this->getCFGroup())); 'cf_group' => $this->getCFGroup()));
$response->headers->set('Content-Type', 'text/csv'); $response->headers->set('Content-Type', 'text/csv; charset=utf-8');
$response->headers->set('Content-Disposition', 'attachment; filename="export.csv"'); $response->headers->set('Content-Disposition', 'attachment; filename="export.csv"');
return $response; return $response;

View File

@ -13,9 +13,9 @@
#}"{{ chill_custom_field_label(customField) }}"{% if not loop.last %},{% endif %}{# #}"{{ chill_custom_field_label(customField) }}"{% if not loop.last %},{% endif %}{#
#}{% endfor %}{# #}{% endfor %}{#
#}{% endif %}{# #}{% endif %}{#
#}
{% for person in persons %}{# #}{{ '\r\n'|raw }}{#
#}{% for person in persons %}{#
#}{{ person.id }},{# #}{{ person.id }},{#
#}"{{ person.firstName|csv_cell }}",{# #}"{{ person.firstName|csv_cell }}",{#
#}"{{ person.lastName|csv_cell }}",{# #}"{{ person.lastName|csv_cell }}",{#
@ -55,6 +55,7 @@
#}{% endif %}{# #}{% endif %}{#
#}{% if not loop.last %},{% endif %}{# #}{% if not loop.last %},{% endif %}{#
#}{% endfor %}{# #}{% endfor %}{#
#}{% endif %} #}{% endif %}{#
#}{{ '\r\n'|raw }}{#
{% endfor %} #}{% endfor %}