php - Need the whole PHPExcel project for dynamically generated Excel file -


Only curious about the requirements of the entire PHPExcel project when you want to create a simple dynamically generated Excel file that is 125 More than lines, I am preparing a report of the names and statistics that go with these names on my site, although after clicking on the button, it takes about 15-20 seconds to generate it, which has so far It's long.

Just wondering if you need the whole project to do this or can you reduce fat (to speak quickly)?

Any help would be greatly appreciated

_helper- & gt; Layout () -> $ this-> Pre-DisabledLayout (); $ Data = factory_ company :: getForAdminCompaniesPage (array ("page size" => 10000, "page" => gt; 0)); $ ObjPHPExcel = new PHPExcel (); $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; getStyle ("A1: J1") - & gt; getFont () - & gt; setBold (right); $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; setAutoFilter ('A1: A1'); $ ObjPHPExcel- & gt; getProperties () - & gt; Set Creator ("StackWare") - & gt; Set Lestodified By ("Johns Smith") - & gt; Settital ("Test Agency List") - & gt; Setsmack ("Test Agency List") - & gt; Set descriptor ("Test Agency List") - & gt; Set keywords ("Test Agency Excel Listings") - & gt; Set category ("test agency"); $ ObjPHPExcel- & gt; Set Active Sheet Index (0) - & gt; Set cell value ('A1', 'agency') - & gt; Set Selwell ('B1', 'Date Added') - & gt; Set Selwell ('C1', # of # #) - & gt; Set Call Value ('D1', '# of Candidates') - & gt; Set cell value ('E1', 'location') - & gt; Setcell Value ('F1', 'Email') - & gt; Setelwell ('I1', 'Sales Rep') - & gt; setCellValue ('J1', 'Active / Inactive') - & gt; setCellValue ('H1', 'Last logged in') - & gt; Set up; $ lineID = 2; foreign currency (data as $ line $$) {$ columnID = 'A'; foreign currency ($ $ as rowArray $ columnValue) {$ objPHPExcel- & gt; GetActiveSheet () -> Setsel value ($ columnID. $ RowID, $ columnValue); $ ColumnID ++;} $ line ID ++;} $ ObjPHPExcel- & gt; GetActiveSheet () - & gt; Settlement ('Intalex Agency list '); $ ObjPHPExcel- & gt; setActiveSheetIndex (0); // a customer's web browser (Excel 2007) header (' Content -Pro Redirect: Redirect output to application / vnd.openxmlformats-officedocument.spreadsheetml.sheet ';; Header (' content-dispute: attachment; filename = "agencies.xlsx" '); header (' cache-control : Max-age = 0 '); // If you are serving in IE 9, then the headers may be required for the following (' Cache-Control: Maximum-Age = 1 '); // If you have IE If you are serving on SSL, then the header for the following may be required ('End: Mon, 26 July 1997 05:00:00 GMT'); // Date in the previous header ('Last-Modified:'. GMDAT ('D, DM YH: I: S'). 'GMT'); // always modified the header ('cache-control: cache, must-revise'); // HTTP / 1.1 Header ('Prague: Public'); // HTTP / 1.0 $ objWriter = PHPExcel_IOFactory :: createWriter ($ objPHPExcel, 'Excel 2007'); $ ObjWriter- & gt; Save ('php: // output'); }

}

You can end the nested foreach loop Are changed

  foreach ($ line data as line $ ray) {$ columnID = 'A'; Forex Currency ($ $ as rowArray $ columnValue) {$ objPHPExcel- & gt; GetActiveSheet () - & gt; Set value ($ columnID. $ RowID, $ columnValue); $ ColumnID ++; } $ Line ID ++; ($ Data in the form of $ array) {$ objPHPExcel- & gt; GetActiveSheet () - & gt; Array ($ linear, tap, 'a'. $ Line id ++); }   

or even just

  $ objPHPExcel-> GetActiveSheet () - & gt; Array ($ data, empty, 'A2');   

and finish

  $ objPHPExcel-> GetActiveSheet () - & gt; Set Autofilter ('A1: A1');   

Because it is auto-filtering failed settings on a single cell, but will add an overhead

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -