>  기사  >  백엔드 개발  >  PHPExcel 导出公式函数的问题

PHPExcel 导出公式函数的问题

WBOY
WBOY원래의
2016-06-23 13:47:412225검색

php  运用phpexcel类 导出excel时    单元格的内容基本都是写入的函数公式   这样很慢  很慢! 各路大神  有没有遇到过这样的事情   怎样解决呢


回复讨论(解决方案)

举个例子看看

$objPHPExcel->setActiveSheetIndex(1)->insertNewRowBefore($count,1);            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('A'.$count, $value['partnum']);            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('B'.$count, $value['wafer']);            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('C'.$count, $value['package']);            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('D'.$count, $value['bpandsum']);            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('E'.$count, "=MAX('forecast data'".'!$R$'.($count+1).",'forecast data'".'!$S$'.($count+1).')');            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('F'.$count, "=Sheet1!E".$count."+'forecast data'!D".($count+1)."+'forecast data'!E".($count+1));            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('G'.$count, "=E".$count."+SUM('forecast data'!D".($count+1).":G".($count+1).")");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('H'.$count, "=E$count+SUM('forecast data'!D".($count+1).":I".($count+1).")");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('I'.$count, "=E$count+SUM('forecast data'!D".($count+1).":K".($count+1).")");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('J'.$count, "=ROUNDUP((MAX(0,E$count-'forecast data'!M".($count+1)."-'forecast data'!N".($count+1)."-'forecast data'!U".($count+1).")*'forecast data'!P".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('K'.$count, "=ROUNDUP((MAX(0,F$count-'forecast data'!M".($count+1)."-'forecast data'!N".($count+1)."-'forecast data'!U".($count+1).")*'forecast data'!P".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('L'.$count, "=ROUNDUP((MAX(0,G$count-'forecast data'!M".($count+1)."-'forecast data'!N".($count+1)."-'forecast data'!U".($count+1).")*'forecast data'!P".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('M'.$count, "=ROUNDUP((MAX(0,H$count-'forecast data'!M".($count+1)."-'forecast data'!N".($count+1)."-'forecast data'!U".($count+1).")*'forecast data'!P".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('N'.$count, "=ROUNDUP((MAX(0,I$count-'forecast data'!M".($count+1)."-'forecast data'!N".($count+1)."-'forecast data'!U".($count+1).")*'forecast data'!P".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('O'.$count, "=ROUNDUP(SUM('forecast data'!D".($count+1).":E".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('P'.$count, "=ROUNDUP(SUM('forecast data'!F".($count+1).":G".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('Q'.$count, "=ROUNDUP(SUM('forecast data'!H".($count+1).":I".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");            	$objPHPExcel->setActiveSheetIndex(1)->setCellValue('R'.$count, "=ROUNDUP(SUM('forecast data'!J".($count+1).":K".($count+1).")/0.9/('forecast data'!AF".($count+1)."/1000),0)");

上面我贴的代码循环循环400条

弄不出来  直接挂点

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.