Forums / Developer / Export CSV ou EXCEL
Anthony M.
Wednesday 24 September 2008 3:10:35 am
Hello,
i have listed some datas in the backoffice, and i want to make an export csv ou xls of these datas... i have created a new template with this code :
<html> <head> <meta http-equiv="Content-Type" content="application/vnd.ms-excel"> </head> </html> {def $pages = fetch( 'content', 'tree', hash( 'parent_node_id', '147', 'sort_by', array( 'modified', false() ) ) )} {foreach $pages as $item} {$item.name};{$item.object.modified|l10n( shortdatetime )}\n {/foreach}
but it doesn't work...is it possible to make this ? can i modify the header in a template ?
thanks a lot for your help
Anthony
Jorge estévez
Wednesday 24 September 2008 4:29:13 am
Hi!
I recommend you stick to something similar to the pagelayout used for the printed version of the page that comes with ez "print_pagelayout.tpl".
I am working in a similar problem exporting (saving somehow) the content of the information of the basket to an excel format, the only problem is that I have to have images, but images are not constrain into a cell (everybody seems to say the same), so it's getting a little difficult to solve this issue.
Diseño Web Cuba Web Design Cuba www.elfosdesign.com
Wednesday 24 September 2008 5:14:18 am
i call my page like this : "http://mysite.com/site_admin/layout/set/excel/" and the page is "excel_pagelayout.tpl"
but the problem is the header...in php i can specify the header like this :
<meta http-equiv="Content-Type" content="application/vnd.ms-excel">
but in the template, i can't do that...
Nicolas Lescure
Wednesday 24 September 2008 12:42:23 pm
Hi,
I can see this in the layout.ini :
# Consists of groups which are the layout name # A layout group can have the followin variables # - PageLayout - Uses a different pagelayout for this page # - ContentType - Sets 'Content-Type' for layout module output # example: ContentType=text/xml
So, you shoud try this :
[excel] PageLayout=excel_pagelayout.tpl ContentType=application/vnd.ms-excel
Thursday 25 September 2008 12:36:13 am
thank you very much, it works fine !! ;-)
Wednesday 01 October 2008 6:15:50 am
Glad you solved your problem,
You can find mime (Multipurpose Internet Mail Extensions) types here:
http://www.w3schools.com/media/media_mimeref.asp
Check it out...
SEBBANE Alexandre
Tuesday 09 December 2008 10:25:51 am
hello , i didnot succeed :
my template is ok :
<html> <body> <table> <tr> <td>Nom-Prénom</td> <td>Entité</td> <td>Téléphone</td> <td>E-mail</td> </tr> <tr> <td>Name1</td> <td>entity</td> <td>phone1</td> <td>mail1</td> </tr> <tr> <td>Name11</td> <td>entity1</td> <td>phone11</td> <td>mail11</td> </tr> </table> </body> </html>
my lyout is just :
{$module_result.content} <!--<!--DEBUG_REPORT-->-->
my layout.ini is
[xls] ContentType=application/vnd.ms-excel PageLayout=xls_pagelayout.tpl
please help me i didn't see what it is wrong
thanks
Paris, France
Tuesday 09 December 2008 11:26:23 am
Did you try this ?
Which url do you use to call your page ?
Piotrek Karaś
Tuesday 09 December 2008 2:12:36 pm
I don't know what 'ou' means, but I've successfully used this library: http://www.phpexcel.net (PHPExcel) This is much better than just trying to force headers... Good luck,Piotrek
-- Company: mediaSELF Sp. z o.o., http://www.mediaself.pl eZ references: http://ez.no/partners/worldwide_partners/mediaself eZ certified developer: http://ez.no/certification/verify/272585 eZ blog: http://ez.ryba.eu