do i have to installed Excel on my machine? if i'm going to use openoffice how is it? --- dell02oo <dell02oo@xxxxxxxxx> wrote: > > > > Hi .. i'm new in here.. and this i my first email .. > > About displaying excel sheet using PHP .. Here's a > code I generate > for the same purpose: > > /* ~~~~~~~~~ Start of Reading Excel ~~~~~~~~~ */ > > $filename = "C:\apache\htdocs\SST\dal\d1.xls"; > $excel_app = new COM("Excel.application") or Die > ("Did not connect"); > print "Application name: > {$excel_app->Application->value}\n" ; > print "Loaded version: > {$excel_app->Application->version}\n"; > $Workbook = $excel_app->Workbooks->Open("$filename") > or Die("Did not > open $filename $Workbook"); > $Worksheet = $Workbook->Worksheets(1); > $Worksheet->activate; > > //I made the loop starts from 2 becouse the fist row > is the heards > which I don't need to know. > // for example I made it reads 11 rows only. > for ( $i=2; $i<12; $i++) > { > if($i < 10) > { > $cella = str_pad('A', 2, $i); > $cellb = str_pad('B', 2, $i); > $cellc = str_pad('C', 2, $i); > } > else if ($i < 100) > { > $cella = str_pad('A', 3, $i); > $cellb = str_pad('B', 3, $i); > $cellc = str_pad('C', 3, $i); > } > else if($i <1000) > { > $cella = str_pad('A', 4, $i); > $cellb = str_pad('B', 4, $i); > $cellc = str_pad('C', 4, $i); > } > else if($i <10000) > { > $cella = str_pad('A', 5, $i); > $cellb = str_pad('B', 5, $i); > $cellc = str_pad('C', 5, $i); > } > > $excel_cell = $Worksheet->Range($cella); > $excel_cell->activate; > $cellarray[$i-2]['id'] = $excel_cell->value; > set_time_limit(1000); > > if ( $excel_cell->value == NULL) { $xlsnum = > $i-2; break; } > > $excel_cell = $Worksheet->Range($cellb); > $cellarray[$i-2]['name'] = > $excel_cell->activate;; > set_time_limit(1000); > > $excel_cell = $Worksheet->Range($cellc); > $excel_cell->activate; > $cellarray[$i-2]['st'] = $excel_cell->value; > set_time_limit(1000); > > echo "<br>--$i--Done"; > > } > > echo "<br>~~~* Excel is Done *~~~<br>"; > > > #To close all instances of excel: > $Workbook->Close; > unset($Worksheet); > unset($Workbook); > > > /* ~~~~~~~~~ End of Excel ~~~~~~~~~ */ > > > Hope this helps u. > > Regards, > dEllo. > > > > > > > > get my key here http://geocities.com/vearn2000/key.txt ************* *********** ********* ******* ***** *** * __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/