Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Export2PDF or excel
Author Message
stefendoza Offline
Redoviti posjetitelj
**

Posts: 81
Joined: Apr 2010
Reputation: 1
Post: #5
RE: Export2PDF or excel
(03-08-2012 09:41 AM)r0tring Wrote:  Probaj prvo izvršiti query
Code:
SET NAMES utf8

To sam probao prvo ali nije dalo rezultate. Pisao sam na jos jednom forumu o ovome pa sam dobio neki prijedlog kako bi header trebao da izgleda:

Code:
header('Content-Description: File Transfer');
        header('Content-Type: application/vnd.ms-excel');
        header('Content-Disposition: attachment; filename='.$filename.'.xls');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
    
        $csv = chr(255) . chr(254) . mb_convert_encoding($csv, 'UTF-16LE', 'UTF-8');
    
        header('Content-Length: '. strlen($csv));
        echo $csv;
        exit;

$filename je ime fajla koji bi se kreirao a promenljiva $csv je string sa podacima a kod mene bi to bio $header i $data (vidi se u prikacenom fajlu).
Navodno ova f-ja mb_convert_encoding() resava problem za sve verzije excel-a. E sad da ja ovo znam upakovati ne bi bio ovde :)
03-08-2012 01:48 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
Export2PDF or excel - stefendoza - 01-08-2012, 01:38 PM
RE: Export2PDF or excel - Gogy - 01-08-2012, 10:40 PM
RE: Export2PDF or excel - stefendoza - 01-08-2012, 10:51 PM
RE: Export2PDF or excel - r0tring - 03-08-2012, 09:41 AM
RE: Export2PDF or excel - stefendoza - 03-08-2012 01:48 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)