Read the exported $objwriter->save (' My-test ' $id. ' xls '); In the file, but actually save the entire page of information, ask the big God pointing

Source: Internet
Author: User
Want to export the $objwriter->save (' My-test '. $id. XLS '); In the file, but actually save the entire page of information, ask the big God pointing
$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.supplier_name from ". Rp_tablepre. " Order_goods as B left join product as a on a.product_id=b.product_id left join supplier as C on C.supplier_name=b.supplier _name left join ' order ' as D on d.order_id =b.order_id where b.order_id= $id ");


$objPHPExcel = new Phpexcel ();
Row height
for ($i = 2; $i <=; $i + +)
{
$objPHPExcel->getactivesheet ()->getrowdimension ($i)->setrowheight (22);
}


$i = 2;
if ($phpexceldao) {
while ($row = Mysql_fetch_array ($phpexceldao)) {
$objPHPExcel->getactivesheet ()->setcellvalue (' A1 ', ' stocking period ');
$objPHPExcel->getactivesheet ()->setcellvalue (' A ' $i, $row [URI]);

$objPHPExcel->getactivesheet ()->setcellvalue (' B1 ', ' purchase number ');
$objPHPExcel->getactivesheet ()->setcellvalue (' B '. $i, $row [order_id]);

$objPHPExcel->getactivesheet ()->setcellvalue (' C1 ', ' product model ');
$objPHPExcel->getactivesheet ()->setcellvalue (' C '. $i, $row [product_id]);

$objPHPExcel->getactivesheet ()->setcellvalue (' D1 ', ' quantity ');
$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 ', ' Order number ');
$objPHPExcel->getactivesheet ()->setcellvalue (' H '. $i, $row [ORDER_SN]);

$objPHPExcel->getactivesheet ()->setcellvalue (' I1 ', ' Order Date ');
$objPHPExcel->getactivesheet ()->setcellvalue (' I ' $i, $row [Dateline]);

$objPHPExcel->getactivesheet ()->setcellvalue (' J1 ', ' Supplier number ');
$objPHPExcel->getactivesheet ()->setcellvalue (' J '. $i, $row [Supplier_name]);
Add a picture
$objPHPExcel->getactivesheet ()->setcellvalue (' G1 ', ' product images ');
$objDrawing = new phpexcel_worksheet_drawing ();
$objDrawing->setname (' Photo ');
$objDrawing->setdescription (' Photo ');
$objDrawing->setpath ($row [product_img]);
$objDrawing->setheight (70);
$objDrawing->setwidth (20);
$objDrawing->setcoordinates (' G '. $i);
$objDrawing->setworksheet ($objPHPExcel->getactivesheet ());

$i + +;
}
}

}
$objWriter = Phpexcel_iofactory::createwriter ($objPHPExcel, ' Excel5 ');
$objWriter->save (' my-test '. $id. XLS ');

Header ("Content-type:text/csv");//Important
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.