note 45181 deleted from ref.com by aidan

From: Date: Sat, 28 Aug 2004 09:07:55 +0000
Subject: note 45181 deleted from ref.com by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75491@lists.php.net to get a copy of this message
Note Submitter: dharm_shankar at rediffmail dot com ---- You can generate multiple sheets with these code <? $excel=new COM("Excel.Application"); $host="localhost"; $user = "root"; $passwd = "publish"; $db = "ihsa_hockey"; mysql_connect($host,$user,$passwd); mysql_select_db($db); $res_no_tab = mysql_list_tables($db); $tot_tab = mysql_num_rows($res_no_tab); $excel->sheetsinnewworkbook=$tot_tab; $excel->Workbooks->Add(); $book=$excel->Workbooks(1); $sheet_no=1; while($tab_name = mysql_fetch_array($res_no_tab)) { $sheetno = $sheet.$sheet_no; $sheetno=$book->Worksheets($sheet_no); $sheetno->Name=$tab_name[0]; $sheetno->activate; echo "<b>Table Name : " .$tab_name[0]."</b>"; $fields = mysql_list_fields($db,$tab_name[0]); $col=mysql_num_fields($fields); $query="SELECT * FROM " . $tab_name[0]; $res=mysql_query($query); $rr=1; while($row = mysql_fetch_array($res)) { echo "<br> Row :".$rr."<br>"; for($i=1;$i<=$col;$i++){ $c=$cell.$i; $c=$sheetno->Cells($rr,$i); $c->Activate; $c->value = $row1[($i-1)]; echo "<b> col ".$i. " : </b>" . $row[$i-1]."<br>"; } $rr++; } echo "=====================END TABLE ".$tab_name[0]."===================================<br>"; } $sheet_no++; $book->saveas("c:\\debug.xls"); $book->Close(false); unset($sheetno); unset($book); $excel->Workbooks->Close(); $excel->Quit(); unset($excel); ?>

« previous php.notes (#75491) next »