-
- require_once('include/common.inc.php');
- require_once(rootpath . 'include/phpexcel/phpexcel/iofactory.php');
-
- $filepath = './file /xls/110713.xls';
-
- $filetype = phpexcel_iofactory::identify($filepath); //The file name automatically determines the file type
- $objreader = phpexcel_iofactory::createreader($filetype);
- $objphpexcel = $objreader- >load($filepath);
-
- $currentsheet = $objphpexcel->getsheet(0); //First workbook
- $allrow = $currentsheet->gethighestrow(); //Number of rows
- $output = array();
- $pretype = '';
-
- #// bbs.it-home.org
- $qh = $currentsheet->getcell('a4')->getvalue();
- //Follow The file format reads data in a loop starting from line 7
- for($currentrow = 7;$currentrow<=$allrow;$currentrow++){
- //Determine whether column b of each row is a valid serial number, if it is empty or less than The previous sequence number ends
- $xh = (int)$currentsheet->getcell('b'.$currentrow)->getvalue();
- if(empty($xh))break;
-
- $tmptype = ( string)$currentsheet->getcell('c'.$currentrow)->getvalue(); //Event type
- if(!empty($tmptype))$pretype = $tmptype;
- $output[$xh] ['type'] = $pretype;
- $output[$xh]['master'] = $currentsheet->getcell('f'.$currentrow)->getvalue(); //Home team
- $output[ $xh]['guest'] = $currentsheet->getcell('h'.$currentrow)->getvalue(); //Guest team
- }
-
- //Loop down from the current row and take out the first rows that are not empty
- for( ; ; $currentrow++){
- $xh = (int)$currentsheet->getcell('b'.$currentrow)->getvalue();
- if(!empty($ xh))break;
- }
-
- for( ; $currentrow <= $allrow; $currentrow++){
- $xh = (int)$currentsheet->getcell('b'.$currentrow)->getvalue( );
- if(empty($xh))break;
-
- $output[$xh]['rq'] = $currentsheet->getcell('i'.$currentrow)->getvalue();
- }
- header("content-type:text/html; charset=utf-8");
-
- echo 'Issue number:' . $qh . "nn";
- if(!empty($output)){
- printf( "%-5st%-15st%-40st%-40st%-5sn", 'serial number', 'event type', 'home team', 'away team', 'handicap value');
- foreach($output as $key => $row){
- $format = "%-5dt%-15st%-40st%-40st%-5sn";
- printf($format, $key, $row['type'], $row[' master'], $row['guest'], $row['rq']);
- }
- }
- ?>
Copy code
|