git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@62490 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
5af4355b78
commit
46d83f9757
|
@ -20,13 +20,17 @@ date_default_timezone_set('Europe/London');
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** Set Include path to point at the PHPExcel Classes folder **/
|
/** 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 **/
|
||||||
include 'PHPExcel/IOFactory.php';
|
include 'PHPExcel/IOFactory.php';
|
||||||
|
|
||||||
|
|
||||||
$inputFileType = 'Excel5';
|
$inputFileType = 'Excel5';
|
||||||
|
// $inputFileType = 'Excel2007';
|
||||||
|
// $inputFileType = 'Excel2003XML';
|
||||||
|
// $inputFileType = 'OOCalc';
|
||||||
|
// $inputFileType = 'Gnumeric';
|
||||||
$inputFileName = './sampleData/example2.xls';
|
$inputFileName = './sampleData/example2.xls';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
|
||||||
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
|
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
|
||||||
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
|
$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
|
||||||
var_dump($sheetData);
|
var_dump($sheetData);
|
||||||
echo '<br />';
|
echo '<br /><br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once('../baseIncludes.php');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -31,7 +31,7 @@ echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactor
|
||||||
try {
|
try {
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
die('Error loading file "',pathinfo($inputFileName,PATHINFO_BASENAME),'": ',$e->getMessage());
|
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue