phpexcel-codeplex http://www.codeplex.com/PHPExcel

  1. Documentation
  2. Change Log

This extension is ... http://www.codeplex.com/PHPExcel Download from phpexcel-codeplex

Resources

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • The vendors.zip is too large ,can't download from yii site;
  • Download from phpexcel-codeplex
  • Extract the release file under protected/vendors
Usage

See the following code example:

Yii::import('application.vendors.PHPExcel',true);
			$objReader = new PHPExcel_Reader_Excel5;
			$objPHPExcel = $objReader->load(@$_FILES['xls']['tmp_name']);
			$objWorksheet = $objPHPExcel->getActiveSheet();
			$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
			$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'
			$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5
			echo '<table>' . "\n";
			for ($row = 2; $row <= $highestRow; ++$row) {
			  echo '<tr>' . "\n";
			  for ($col = 0; $col <= $highestColumnIndex; ++$col) {
			    echo '<td>' . $objWorksheet->getCellByColumnAndRow($col, $row)->getValue() . '</td>' . "\n";
			  }
			  echo '</tr>' . "\n";
			}
			echo '</table>' . "\n";

Change Log

August 28, 2010
  • Initial release.
6 0
7 followers
27 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Tags:
Developed by: sharehua
Created on: Aug 28, 2010
Last updated: 13 years ago