note 63109 added to ref.com

From: Date: Mon, 13 Mar 2006 17:36:55 +0000
Subject: note 63109 added to ref.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-105727@lists.php.net to get a copy of this message
In case you are wondering how to group rows or columns in the freshly created EXCEL files, then this may help you <? /*** * Grouping Rows optically in Excel Using a COM Object * * That was not easy, I have spent several hours of trial and error to get * this thing to work!!! * * @author Kulikov Alexey <a.kulikov@gmail.com> * @since 13.03.2006 * * @see Open Excel, Hit Alt+F11, thne Hit F2 -- this is your COM bible ***/ //starting excel $excel = new COM("excel.application") or die("Unable to instanciate excel"); print "Loaded excel, version {$excel->Version}\n"; //bring it to front #$excel->Visible = 1;//NOT //dont want alerts ... run silent $excel->DisplayAlerts = 0; //create a new workbook $wkb = $excel->Workbooks->Add(); //select the default sheet $sheet=$wkb->Worksheets(1); //make it the active sheet $sheet->activate; //fill it with some bogus data for($row=1;$row<=7;$row++){ for ($col=1;$col<=5;$col++){ $sheet->activate; $cell=$sheet->Cells($row,$col); $cell->Activate; $cell->value = 'pool4tool 4eva ' . $row . ' ' . $col . ' ak'; }//end of colcount for loop } /////////// // Select Rows 2 to 5 $r = $sheet->Range("2:5")->Rows; // group them baby, yeah $r->Cells->Group; // save the new file $strPath = 'tfile.xls'; if (file_exists($strPath)) {unlink($strPath);} $wkb->SaveAs($strPath); //close the book $wkb->Close(false); $excel->Workbooks->Close(); //free up the RAM unset($sheet); //closing excel $excel->Quit(); //free the object $excel = null; ?> ---- Server IP: 192.35.244.50 Probable Submitter: 62.178.245.90 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.com.php Edit -- http://master.php.net/note/edit/63109 Del: integrated -- http://master.php.net/note/delete/63109/integrated Del: useless -- http://master.php.net/note/delete/63109/useless Del: bad code -- http://master.php.net/note/delete/63109/bad+code Del: spam -- http://master.php.net/note/delete/63109/spam Del: non-english -- http://master.php.net/note/delete/63109/non-english Del: in docs -- http://master.php.net/note/delete/63109/in+docs Del: other reasons-- http://master.php.net/note/delete/63109 Reject -- http://master.php.net/note/reject/63109 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105727) next »