//添加图片
/*
$obj=$objPHPExcel->getActiveSheet();
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('wsyImg');
$objDrawing->setDescription('Image inserted by zhy');
$objDrawing->setPath('./wsy.jpg');
$objDrawing->setHeight(50);
$objDrawing->setCoordinates('H23');
$objDrawing->setOffsetX(60);
$objDrawing->setRotation(-10); /
$objDrawing->getShadow()->setVisible(true);
$objDrawing->getShadow()->setDirection(-20); /
$objDrawing->setWorksheet($obj);
*/
//页眉页脚
//$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('zhy');
//$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('end');
$objPHPExcel->setActiveSheetIndex(0);
$tname=date('Y-m-dH',time());
$tnam=iconv('UTF-8','GBK','祖名订单');
$tname=$tnam.$tname;
// Excel 2007保存
//$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
//$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
// Excel 5保存
//$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
//$objWriter->save(str_replace('.php', '.xls', __FILE__));
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));
//$url = "/data/home/htdocs/ec/public/files/".date("Y")."https://www.jb51.net/".date("Ym")."https://www.jb51.net/";
createDir($url);
function createDir($dir) {
if (!is_dir ($dir )) {
mkdir($dir, 0777, true);
chmod($dir, 0777);
chown( $dir, 'daemon' );
chgrp( $dir, 'daemon' );
}
}
$name='forexmple_excel';
rename(str_replace('.php', '.xls', __FILE__), $name.'.xls');
?>