Voila l'exemple et il vous vous les bibiothéaue de la classe BiffWriter.
Si t'en a pas trouvé ces bibiothéque laisse moi ton e-mail pour te les envoyées.
cette exemple marche 100% je l'ai bien téster dans mon application et ca marche a mervielle.
et si il ya un probléme contact moi.
<?php
require_once('Spreadsheet\\Excel\\Writer\\BIFFwriter.php');
require_once('Spreadsheet\\Excel\\Writer\\Worksheet.php');
require_once('Spreadsheet\\Excel\\Writer\\Workbook.php');function HeaderingExcel($filename) {
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$filename" );
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Pragma: public");
}// HTTP headers
HeaderingExcel('test.xls');// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer_Workbook("-");
$t=& $workbook->addformat();
$t->setSize(16);
$t->setAlign('center');
$t->setColor('red');
$t->setPattern();
$title=& $workbook->addformat();
$title->setSize(12);
$title->setAlign('center');
$title->setColor('white');
$title->setPattern();
$title->setBgColor('dark');
$fh=& $workbook->addformat();
$fh->setSize(10);
$fh->setAlign('center');
$fh->setColor('red');
$fh->setPattern();
$fh->setBgColor('white');
// 1ere feille
$worksheet1 =& $workbook->addworksheet('Liste Tous Les Clients');
$worksheet1->write(3,4,"Liste De Tous Les Clients",$t);
$worksheet1->write(5, 2, "Num Client",$fh);
$worksheet1->write(5, 3, "Nom Client",$fh);
$worksheet1->write(5, 4, "Prenom Client",$fh);
$worksheet1->write(5, 5, "Date Naissance",$fh);
$worksheet1->write(5, 6, "ville",$fh);
$bitmap="Sans titre.bmp";
$worksheet1->insertBitmap(10, 10, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1);
$worksheet1->_positionImage(10, 10, 10, 10, 480, 359);
$link=mysql_connect('localhost','root','');
$db=mysql_select_db('gestion_client');
if(isset($_GET['id'])){
$sql=$_GET['id'];
}
$res=mysql_query($sql);
$num=mysql_num_rows($res);
if($res){
while($row=mysql_fetch_row($res)){
//pour positionner les donnée dans la feuille
static $x1=6;
static $y1=2;
$worksheet1->write($x1, $y1, "".$row[0],$title);
$worksheet1->write($x1, $y1+1, "".$row[1],$title);
$worksheet1->write($x1, $y1+2, "".$row[2],$title);
$worksheet1->write($x1, $y1+3, "".$row[3],$title);
$worksheet1->write($x1, $y1+4, "".$row[4],$title);
$y1=2;
$x1=$x1+1;
}
}
//2emme fieulle
$worksheet2 =& $workbook->addworksheet('Rabat');
$worksheet2->write(3,4,"Liste De Tous Les Clt De Rabat.",$t);
$worksheet2->write(5, 2, "Num Client",$fh);
$worksheet2->write(5, 3, "Nom Client",$fh);
$worksheet2->write(5, 4, "Prenom Client",$fh);
$worksheet2->write(5, 5, "Date Naissance",$fh);
$worksheet2->write(5, 6, "ville",$fh);
$req="select * from client where ville='rabat'";
$res=mysql_query($req);
$num=mysql_num_rows($res);
if($res){
while($row=mysql_fetch_row($res)){
static $x2=6;
static $y2=2;
$worksheet2->write($x2, $y2, "".$row[0],$title);
$worksheet2->write($x2, $y2+1, "".$row[1],$title);
$worksheet2->write($x2, $y2+2, "".$row[2],$title);
$worksheet2->write($x2, $y2+3, "".$row[3],$title);
$worksheet2->write($x2, $y2+4, "".$row[4],$title);
$y2=2;
$x2=$x2+1;
}
}
//3emme fieulle
$worksheet3 =& $workbook->addworksheet('casa');
$worksheet3->write(3,4,"Liste De Tous Les Clt De Casa.",$t);
$worksheet3->write(5, 2, "Num Client",$fh);
$worksheet3->write(5, 3, "Nom Client",$fh);
$worksheet3->write(5, 4, "Prenom Client",$fh);
$worksheet3->write(5, 5, "Date Naissance",$fh);
$worksheet3->write(5, 6, "ville",$fh);
$query="select * from client where ville='casa'";
$res=mysql_query($query);
$num=mysql_num_rows($res);
if($res){
while($row=mysql_fetch_row($res)){
static $x3=6;
static $y3=2;
$worksheet3->write($x3, $y3, "".$row[0],$title);
$worksheet3->write($x3, $y3+1, "".$row[1],$title);
$worksheet3->write($x3, $y3+2, "".$row[2],$title);
$worksheet3->write($x3, $y3+3, "".$row[3],$title);
$worksheet3->write($x3, $y3+4, "".$row[4],$title);
$y3=2;
$x3=$x3+1;
}
}
//4emme fieulle
$worksheet4 =& $workbook->addworksheet('sale');
$worksheet4->write(3,4,"Liste De Tous Les Clt De Sale. ",$t);
$worksheet4->write(5, 2, "Num Client",$fh);
$worksheet4->write(5, 3, "Nom Client",$fh);
$worksheet4->write(5, 4, "Prenom Client",$fh);
$worksheet4->write(5, 5, "Date Naissance",$fh);
$worksheet4->write(5, 6, "ville",$fh);
$ql="select * from client where ville='sale'";
$res=mysql_query($ql);
$num=mysql_num_rows($res);
if($res){
while($row=mysql_fetch_row($res)){
static $x4=6;
static $y4=2;
$worksheet4->write($x4, $y4, "".$row[0],$title);
$worksheet4->write($x4, $y4+1, "".$row[1],$title);
$worksheet4->write($x4, $y4+2, "".$row[2],$title);
$worksheet4->write($x4, $y4+3, "".$row[3],$title);
$worksheet4->write($x4, $y4+4, "".$row[4],$title);
$y4=2;
$x4=$x4+1;
}
}
$workbook->close();
?>
j'éspére que ca vous aidra.
Coordialement.
c'est moi kenchi le vogaband.