How to export formula functions in PHPExcel

Source: Internet
Author: User
How to export formula functions in PHPExcel php when using phpexcel to export excel, the cell content is basically written function formulas. this is very slow and slow! Have you ever encountered such a problem? how can this problem be solved?


Reply to discussion (solution)

For example

$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)");

The code I posted above loops 400 items

You can't figure it out and click it directly.

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.