PHPExcel 导出公式函数的问题

WBOY
Release: 2016-06-23 13:47:41
Original
2223 people have browsed it

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)");
Copy after login

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

弄不出来  直接挂点

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template