EasyUI Forum
September 13, 2025, 12:34:00 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Export to Excel the loaded data in datagrid  (Read 11085 times)
kiran1234
Newbie
*
Posts: 2


View Profile
« on: January 19, 2016, 03:15:33 AM »

I tried the topics posted in the forum, but non was helpful. Is there any other solution to export the data from datagrid with same format to excel. Please help. Need header and data. Thanks.
Logged
ehussain
Newbie
*
Posts: 16


View Profile Email
« Reply #1 on: January 19, 2016, 04:22:44 AM »

try phpExcel

https://phpexcel.codeplex.com/wikipage?title=Examples&referringTitle=Home

I can help if you want to do phpExcel.

Ejaz
Logged
kiran1234
Newbie
*
Posts: 2


View Profile
« Reply #2 on: January 19, 2016, 06:50:30 AM »

Hi, I have configured with PHPExcel.

Its working well.  But I'm unable to get column names as header. Can u please help.

$q = mysql_query("select * from mytable");

while($mrow = mysql_fetch_assoc($q)) {
    $col = 0;
    foreach($mrow as $key=>$value) {
        $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, 0, $key);
        $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row + 1, $value);
        $col++;
    }
    $row++;
 }

Logged
ehussain
Newbie
*
Posts: 16


View Profile Email
« Reply #3 on: January 19, 2016, 02:14:52 PM »

$q = mysql_query("select * from mytable");

while($mrow = mysql_fetch_assoc($q)) {
    $col = 0;
    foreach($mrow as $key=>$value) {
        $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($col, 0, $key);
        $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row + 1, $value);
        $col++;
    }
    $row++;
 }
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!