git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@62490 2327b42d-5241-43d6-9e2a-de5ac946f064

This commit is contained in:
Mark Baker 2010-10-20 12:57:51 +00:00
parent 5af4355b78
commit 46d83f9757
5 changed files with 56 additions and 5 deletions

View File

@ -20,13 +20,17 @@ date_default_timezone_set('Europe/London');
<?php
/** Set Include path to point at the PHPExcel Classes folder **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../../PHPExcel/Classes/');
set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
/** Include PHPExcel_IOFactory **/
include 'PHPExcel/IOFactory.php';
$inputFileType = 'Excel5';
// $inputFileType = 'Excel2007';
// $inputFileType = 'Excel2003XML';
// $inputFileType = 'OOCalc';
// $inputFileType = 'Gnumeric';
$inputFileName = './sampleData/example2.xls';

View File

@ -51,7 +51,7 @@ foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
var_dump($sheetData);
echo '<br />';
echo '<br /><br />';
}

View File

@ -1,7 +1,5 @@
<?php
include_once('../baseIncludes.php');
?>
<html>
<head>

View File

@ -31,7 +31,7 @@ echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactor
try {
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
} catch(Exception $e) {
die('Error loading file "',pathinfo($inputFileName,PATHINFO_BASENAME),'": ',$e->getMessage());
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}

View File

@ -0,0 +1,49 @@
<?php
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PHPExcel Examples</title>
</head>
<body>
<?php
$exampleTypeList = glob('./*',GLOB_ONLYDIR);
foreach($exampleTypeList as $exampleType) {
echo '<h1>PHPExcel '.pathinfo($exampleType,PATHINFO_BASENAME).' Examples</h1>';
$exampleList = glob('./'.$exampleType.'/*.php');
foreach($exampleList as $exampleFile) {
$fileData = file_get_contents($exampleFile);
$h1Pattern = '#<h1>(.*?)</h1>#';
$h2Pattern = '#<h2>(.*?)</h2>#';
if (preg_match($h1Pattern, $fileData, $out)) {
$h1Text = $out[1];
$h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />';
if ($h2Text > '') {
echo $h2Text,'<br />';
}
}
}
}
?>
<body>
</html>