$objWriter->save('my-test'.$id.'.xls'); でファイルをエクスポートしたいのですが、実際に保存されるのはページ全体の情報です$phpexceldao = $db ->query("select a.uri,b.order_id,b.product_id,b.qty,b.goods_groups,b.attr,a.product_img,d.order_sn,d.dateline,c 「.RP_TABLEPRE .」の .supplier_name .order_goods as b left join product as a on a.product_id=b.product_id left join サプライヤー as c on c.supplier_name=b.supplier_name left join `order` as d on d.order_id =b .order_id ここで、 b.order_id =$id");
$objPHPExcel = 新しい PHPExcel();
//行の高さ
for($i = 2; $i
{
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(22);
}
$i=2;
if($phpexceldao){
While($row= mysql_fetch_array($phpexceldao)){
$objPHPExcel->getActiveSheet()->setCellValue('A1','準備期間');
$objPHPExcel->getActiveSheet()->setCellValue('A'.$i,$row[uri]);
$objPHPExcel->getActiveSheet()->setCellValue('B1','購入番号');
$objPHPExcel->getActiveSheet()->setCellValue('B'.$i,$row[order_id]);
$objPHPExcel->getActiveSheet()->setCellValue('C1','製品モデル');
$objPHPExcel->getActiveSheet()->setCellValue('C'.$i,$row[product_id]);
$objPHPExcel->getActiveSheet()->setCellValue('D1','数量');
$objPHPExcel->getActiveSheet()->setCellValue('D'.$i,$row[qty]);
$objPHPExcel->getActiveSheet()->setCellValue('E1','Category');
$objPHPExcel->getActiveSheet()->setCellValue('E'.$i,$row[goods_groups]);
$objPHPExcel->getActiveSheet()->setCellValue('F1','Size');
$objPHPExcel->getActiveSheet()->setCellValue('F'.$i,$row[attr]);
$objPHPExcel->getActiveSheet()->setCellValue('H1','注文番号');
$objPHPExcel->getActiveSheet()->setCellValue('H'.$i,$row[order_sn]);
$objPHPExcel->getActiveSheet()->setCellValue('I1','注文日');
$objPHPExcel->getActiveSheet()->setCellValue('I'.$i,$row[dateline]);
$objPHPExcel->getActiveSheet()->setCellValue('J1','サプライヤー番号');
$objPHPExcel->getActiveSheet()->setCellValue('J'.$i,$row[supplier_name]);
//写真を追加
$objPHPExcel->getActiveSheet()->setCellValue('G1','製品画像');
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('写真');
$objDrawing->setDescription('写真');
$objDrawing->setPath($row[product_img]);
$objDrawing->setHeight(70);
$objDrawing->setWidth(20);
$objDrawing->setCoowned('G'.$i);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$i++;
}
}
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('my-test'.$id.'.xls');
header("Content-type: text/csv");//重要