PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.0.10
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.0.10
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Gnumeric.php +786 -763 3.1.03.0.10 View file →
@@ -1,19 +1,9 @@
1 1 <?php
2 -
3 -/** PHPExcel root directory */
4 -if (!defined('PHPEXCEL_ROOT')) {
5 - /**
6 - * @ignore
7 - */
8 - define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9 - require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10 -}
11 -
12 2 /**
13 - * PHPExcel_Reader_Gnumeric
3 + * PHPExcel
14 4 *
15 - * Copyright (c) 2006 - 2015 PHPExcel
5 + * Copyright (c) 2006 - 2014 PHPExcel
16 6 *
17 7 * This library is free software; you can redistribute it and/or
18 8 * modify it under the terms of the GNU Lesser General Public
19 9 * License as published by the Free Software Foundation; either
@@ -29,822 +19,855 @@
29 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 20 *
31 21 * @category PHPExcel
32 22 * @package PHPExcel_Reader
33 - * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34 - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
24 + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
35 25 * @version ##VERSION##, ##DATE##
36 26 */
27 +
28 +
29 +/** PHPExcel root directory */
30 +if (!defined('PHPEXCEL_ROOT')) {
31 + /**
32 + * @ignore
33 + */
34 + define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35 + require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
36 +}
37 +
38 +/**
39 + * PHPExcel_Reader_Gnumeric
40 + *
41 + * @category PHPExcel
42 + * @package PHPExcel_Reader
43 + * @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
44 + */
37 45 class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
38 46 {
39 - /**
40 - * Formats
41 - *
42 - * @var array
43 - */
44 - private $styles = array();
47 + /**
48 + * Formats
49 + *
50 + * @var array
51 + */
52 + private $_styles = array();
45 53
46 - /**
47 - * Shared Expressions
48 - *
49 - * @var array
50 - */
51 - private $expressions = array();
54 + /**
55 + * Shared Expressions
56 + *
57 + * @var array
58 + */
59 + private $_expressions = array();
52 60
53 - private $referenceHelper = null;
61 + private $_referenceHelper = null;
54 62
55 - /**
56 - * Create a new PHPExcel_Reader_Gnumeric
57 - */
58 - public function __construct()
59 - {
60 - $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
61 - $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
62 - }
63 63
64 - /**
65 - * Can the current PHPExcel_Reader_IReader read the file?
66 - *
67 - * @param string $pFilename
68 - * @return boolean
69 - * @throws PHPExcel_Reader_Exception
70 - */
71 - public function canRead($pFilename)
72 - {
73 - // Check if file exists
74 - if (!file_exists($pFilename)) {
75 - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
76 - }
64 + /**
65 + * Create a new PHPExcel_Reader_Gnumeric
66 + */
67 + public function __construct() {
68 + $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
69 + $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
70 + }
77 71
78 - // Check if gzlib functions are available
79 - if (!function_exists('gzread')) {
80 - throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
81 - }
82 72
83 - // Read signature data (first 3 bytes)
84 - $fh = fopen($pFilename, 'r');
85 - $data = fread($fh, 2);
86 - fclose($fh);
73 + /**
74 + * Can the current PHPExcel_Reader_IReader read the file?
75 + *
76 + * @param string $pFilename
77 + * @return boolean
78 + * @throws PHPExcel_Reader_Exception
79 + */
80 + public function canRead($pFilename)
81 + {
82 + // Check if file exists
83 + if (!file_exists($pFilename)) {
84 + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
85 + }
87 86
88 - if ($data != chr(0x1F).chr(0x8B)) {
89 - return false;
90 - }
87 + // Check if gzlib functions are available
88 + if (!function_exists('gzread')) {
89 + throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
90 + }
91 91
92 - return true;
93 - }
92 + // Read signature data (first 3 bytes)
93 + $fh = fopen($pFilename, 'r');
94 + $data = fread($fh, 2);
95 + fclose($fh);
94 96
95 - /**
96 - * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
97 - *
98 - * @param string $pFilename
99 - * @throws PHPExcel_Reader_Exception
100 - */
101 - public function listWorksheetNames($pFilename)
102 - {
103 - // Check if file exists
104 - if (!file_exists($pFilename)) {
105 - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
106 - }
97 + if ($data != chr(0x1F).chr(0x8B)) {
98 + return false;
99 + }
107 100
108 - $xml = new XMLReader();
109 - $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
110 - $xml->setParserProperty(2, true);
101 + return true;
102 + }
111 103
112 - $worksheetNames = array();
113 - while ($xml->read()) {
114 - if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) {
115 - $xml->read(); // Move onto the value node
116 - $worksheetNames[] = (string) $xml->value;
117 - } elseif ($xml->name == 'gnm:Sheets') {
118 - // break out of the loop once we've got our sheet names rather than parse the entire file
119 - break;
120 - }
121 - }
122 104
123 - return $worksheetNames;
124 - }
105 + /**
106 + * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
107 + *
108 + * @param string $pFilename
109 + * @throws PHPExcel_Reader_Exception
110 + */
111 + public function listWorksheetNames($pFilename)
112 + {
113 + // Check if file exists
114 + if (!file_exists($pFilename)) {
115 + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
116 + }
125 117
126 - /**
127 - * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
128 - *
129 - * @param string $pFilename
130 - * @throws PHPExcel_Reader_Exception
131 - */
132 - public function listWorksheetInfo($pFilename)
133 - {
134 - // Check if file exists
135 - if (!file_exists($pFilename)) {
136 - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
137 - }
118 + $xml = new XMLReader();
119 + $xml->xml(
120 + $this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()
121 + );
122 + $xml->setParserProperty(2,true);
138 123
139 - $xml = new XMLReader();
140 - $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
141 - $xml->setParserProperty(2, true);
124 + $worksheetNames = array();
125 + while ($xml->read()) {
126 + if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) {
127 + $xml->read(); // Move onto the value node
128 + $worksheetNames[] = (string) $xml->value;
129 + } elseif ($xml->name == 'gnm:Sheets') {
130 + // break out of the loop once we've got our sheet names rather than parse the entire file
131 + break;
132 + }
133 + }
142 134
143 - $worksheetInfo = array();
144 - while ($xml->read()) {
145 - if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) {
146 - $tmpInfo = array(
147 - 'worksheetName' => '',
148 - 'lastColumnLetter' => 'A',
149 - 'lastColumnIndex' => 0,
150 - 'totalRows' => 0,
151 - 'totalColumns' => 0,
152 - );
135 + return $worksheetNames;
136 + }
153 137
154 - while ($xml->read()) {
155 - if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) {
156 - $xml->read(); // Move onto the value node
157 - $tmpInfo['worksheetName'] = (string) $xml->value;
158 - } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) {
159 - $xml->read(); // Move onto the value node
160 - $tmpInfo['lastColumnIndex'] = (int) $xml->value;
161 - $tmpInfo['totalColumns'] = (int) $xml->value + 1;
162 - } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) {
163 - $xml->read(); // Move onto the value node
164 - $tmpInfo['totalRows'] = (int) $xml->value + 1;
165 - break;
166 - }
167 - }
168 - $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
169 - $worksheetInfo[] = $tmpInfo;
170 - }
171 - }
172 138
173 - return $worksheetInfo;
174 - }
139 + /**
140 + * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
141 + *
142 + * @param string $pFilename
143 + * @throws PHPExcel_Reader_Exception
144 + */
145 + public function listWorksheetInfo($pFilename)
146 + {
147 + // Check if file exists
148 + if (!file_exists($pFilename)) {
149 + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
150 + }
175 151
176 - private function gzfileGetContents($filename)
177 - {
178 - $file = @gzopen($filename, 'rb');
179 - if ($file !== false) {
180 - $data = '';
181 - while (!gzeof($file)) {
182 - $data .= gzread($file, 1024);
183 - }
184 - gzclose($file);
185 - }
186 - return $data;
187 - }
152 + $xml = new XMLReader();
153 + $xml->xml(
154 + $this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions()
155 + );
156 + $xml->setParserProperty(2,true);
188 157
189 - /**
190 - * Loads PHPExcel from file
191 - *
192 - * @param string $pFilename
193 - * @return PHPExcel
194 - * @throws PHPExcel_Reader_Exception
195 - */
196 - public function load($pFilename)
197 - {
198 - // Create new PHPExcel
199 - $objPHPExcel = new PHPExcel();
158 + $worksheetInfo = array();
159 + while ($xml->read()) {
160 + if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) {
161 + $tmpInfo = array(
162 + 'worksheetName' => '',
163 + 'lastColumnLetter' => 'A',
164 + 'lastColumnIndex' => 0,
165 + 'totalRows' => 0,
166 + 'totalColumns' => 0,
167 + );
200 168
201 - // Load into this instance
202 - return $this->loadIntoExisting($pFilename, $objPHPExcel);
203 - }
169 + while ($xml->read()) {
170 + if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) {
171 + $xml->read(); // Move onto the value node
172 + $tmpInfo['worksheetName'] = (string) $xml->value;
173 + } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) {
174 + $xml->read(); // Move onto the value node
175 + $tmpInfo['lastColumnIndex'] = (int) $xml->value;
176 + $tmpInfo['totalColumns'] = (int) $xml->value + 1;
177 + } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) {
178 + $xml->read(); // Move onto the value node
179 + $tmpInfo['totalRows'] = (int) $xml->value + 1;
180 + break;
181 + }
182 + }
183 + $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
184 + $worksheetInfo[] = $tmpInfo;
185 + }
186 + }
204 187
205 - /**
206 - * Loads PHPExcel from file into PHPExcel instance
207 - *
208 - * @param string $pFilename
209 - * @param PHPExcel $objPHPExcel
210 - * @return PHPExcel
211 - * @throws PHPExcel_Reader_Exception
212 - */
213 - public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
214 - {
215 - // Check if file exists
216 - if (!file_exists($pFilename)) {
217 - throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
218 - }
188 + return $worksheetInfo;
189 + }
219 190
220 - $timezoneObj = new DateTimeZone('Europe/London');
221 - $GMT = new DateTimeZone('UTC');
222 191
223 - $gFileData = $this->gzfileGetContents($pFilename);
192 + private function _gzfileGetContents($filename) {
193 + $file = @gzopen($filename, 'rb');
194 + if ($file !== false) {
195 + $data = '';
196 + while (!gzeof($file)) {
197 + $data .= gzread($file, 1024);
198 + }
199 + gzclose($file);
200 + }
201 + return $data;
202 + }
224 203
225 -// echo '<pre>';
226 -// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
227 -// echo '</pre><hr />';
204 +
205 + /**
206 + * Loads PHPExcel from file
207 + *
208 + * @param string $pFilename
209 + * @return PHPExcel
210 + * @throws PHPExcel_Reader_Exception
211 + */
212 + public function load($pFilename)
213 + {
214 + // Create new PHPExcel
215 + $objPHPExcel = new PHPExcel();
216 +
217 + // Load into this instance
218 + return $this->loadIntoExisting($pFilename, $objPHPExcel);
219 + }
220 +
221 +
222 + /**
223 + * Loads PHPExcel from file into PHPExcel instance
224 + *
225 + * @param string $pFilename
226 + * @param PHPExcel $objPHPExcel
227 + * @return PHPExcel
228 + * @throws PHPExcel_Reader_Exception
229 + */
230 + public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
231 + {
232 + // Check if file exists
233 + if (!file_exists($pFilename)) {
234 + throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
235 + }
236 +
237 + $timezoneObj = new DateTimeZone('Europe/London');
238 + $GMT = new DateTimeZone('UTC');
239 +
240 + $gFileData = $this->_gzfileGetContents($pFilename);
241 +
242 +// echo '<pre>';
243 +// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
244 +// echo '</pre><hr />';
228 245 //
229 - $xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
230 - $namespacesMeta = $xml->getNamespaces(true);
246 + $xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
247 + $namespacesMeta = $xml->getNamespaces(true);
231 248
232 -// var_dump($namespacesMeta);
249 +// var_dump($namespacesMeta);
233 250 //
234 - $gnmXML = $xml->children($namespacesMeta['gnm']);
251 + $gnmXML = $xml->children($namespacesMeta['gnm']);
235 252
236 - $docProps = $objPHPExcel->getProperties();
237 - // Document Properties are held differently, depending on the version of Gnumeric
238 - if (isset($namespacesMeta['office'])) {
239 - $officeXML = $xml->children($namespacesMeta['office']);
240 - $officeDocXML = $officeXML->{'document-meta'};
241 - $officeDocMetaXML = $officeDocXML->meta;
253 + $docProps = $objPHPExcel->getProperties();
254 + // Document Properties are held differently, depending on the version of Gnumeric
255 + if (isset($namespacesMeta['office'])) {
256 + $officeXML = $xml->children($namespacesMeta['office']);
257 + $officeDocXML = $officeXML->{'document-meta'};
258 + $officeDocMetaXML = $officeDocXML->meta;
242 259
243 - foreach ($officeDocMetaXML as $officePropertyData) {
244 - $officePropertyDC = array();
245 - if (isset($namespacesMeta['dc'])) {
246 - $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
247 - }
248 - foreach ($officePropertyDC as $propertyName => $propertyValue) {
249 - $propertyValue = (string) $propertyValue;
250 - switch ($propertyName) {
251 - case 'title':
252 - $docProps->setTitle(trim($propertyValue));
253 - break;
254 - case 'subject':
255 - $docProps->setSubject(trim($propertyValue));
256 - break;
257 - case 'creator':
258 - $docProps->setCreator(trim($propertyValue));
259 - $docProps->setLastModifiedBy(trim($propertyValue));
260 - break;
261 - case 'date':
262 - $creationDate = strtotime(trim($propertyValue));
263 - $docProps->setCreated($creationDate);
264 - $docProps->setModified($creationDate);
265 - break;
266 - case 'description':
267 - $docProps->setDescription(trim($propertyValue));
268 - break;
269 - }
270 - }
271 - $officePropertyMeta = array();
272 - if (isset($namespacesMeta['meta'])) {
273 - $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
274 - }
275 - foreach ($officePropertyMeta as $propertyName => $propertyValue) {
276 - $attributes = $propertyValue->attributes($namespacesMeta['meta']);
277 - $propertyValue = (string) $propertyValue;
278 - switch ($propertyName) {
279 - case 'keyword':
280 - $docProps->setKeywords(trim($propertyValue));
281 - break;
282 - case 'initial-creator':
283 - $docProps->setCreator(trim($propertyValue));
284 - $docProps->setLastModifiedBy(trim($propertyValue));
285 - break;
286 - case 'creation-date':
287 - $creationDate = strtotime(trim($propertyValue));
288 - $docProps->setCreated($creationDate);
289 - $docProps->setModified($creationDate);
290 - break;
291 - case 'user-defined':
292 - list(, $attrName) = explode(':', $attributes['name']);
293 - switch ($attrName) {
294 - case 'publisher':
295 - $docProps->setCompany(trim($propertyValue));
296 - break;
297 - case 'category':
298 - $docProps->setCategory(trim($propertyValue));
299 - break;
300 - case 'manager':
301 - $docProps->setManager(trim($propertyValue));
302 - break;
303 - }
304 - break;
305 - }
306 - }
307 - }
308 - } elseif (isset($gnmXML->Summary)) {
309 - foreach ($gnmXML->Summary->Item as $summaryItem) {
310 - $propertyName = $summaryItem->name;
311 - $propertyValue = $summaryItem->{'val-string'};
312 - switch ($propertyName) {
313 - case 'title':
314 - $docProps->setTitle(trim($propertyValue));
315 - break;
316 - case 'comments':
317 - $docProps->setDescription(trim($propertyValue));
318 - break;
319 - case 'keywords':
320 - $docProps->setKeywords(trim($propertyValue));
321 - break;
322 - case 'category':
323 - $docProps->setCategory(trim($propertyValue));
324 - break;
325 - case 'manager':
326 - $docProps->setManager(trim($propertyValue));
327 - break;
328 - case 'author':
329 - $docProps->setCreator(trim($propertyValue));
330 - $docProps->setLastModifiedBy(trim($propertyValue));
331 - break;
332 - case 'company':
333 - $docProps->setCompany(trim($propertyValue));
334 - break;
335 - }
336 - }
337 - }
260 + foreach($officeDocMetaXML as $officePropertyData) {
338 261
339 - $worksheetID = 0;
340 - foreach ($gnmXML->Sheets->Sheet as $sheet) {
341 - $worksheetName = (string) $sheet->Name;
342 -// echo '<b>Worksheet: ', $worksheetName,'</b><br />';
343 - if ((isset($this->loadSheetsOnly)) && (!in_array($worksheetName, $this->loadSheetsOnly))) {
344 - continue;
345 - }
262 + $officePropertyDC = array();
263 + if (isset($namespacesMeta['dc'])) {
264 + $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
265 + }
266 + foreach($officePropertyDC as $propertyName => $propertyValue) {
267 + $propertyValue = (string) $propertyValue;
268 + switch ($propertyName) {
269 + case 'title' :
270 + $docProps->setTitle(trim($propertyValue));
271 + break;
272 + case 'subject' :
273 + $docProps->setSubject(trim($propertyValue));
274 + break;
275 + case 'creator' :
276 + $docProps->setCreator(trim($propertyValue));
277 + $docProps->setLastModifiedBy(trim($propertyValue));
278 + break;
279 + case 'date' :
280 + $creationDate = strtotime(trim($propertyValue));
281 + $docProps->setCreated($creationDate);
282 + $docProps->setModified($creationDate);
283 + break;
284 + case 'description' :
285 + $docProps->setDescription(trim($propertyValue));
286 + break;
287 + }
288 + }
289 + $officePropertyMeta = array();
290 + if (isset($namespacesMeta['meta'])) {
291 + $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
292 + }
293 + foreach($officePropertyMeta as $propertyName => $propertyValue) {
294 + $attributes = $propertyValue->attributes($namespacesMeta['meta']);
295 + $propertyValue = (string) $propertyValue;
296 + switch ($propertyName) {
297 + case 'keyword' :
298 + $docProps->setKeywords(trim($propertyValue));
299 + break;
300 + case 'initial-creator' :
301 + $docProps->setCreator(trim($propertyValue));
302 + $docProps->setLastModifiedBy(trim($propertyValue));
303 + break;
304 + case 'creation-date' :
305 + $creationDate = strtotime(trim($propertyValue));
306 + $docProps->setCreated($creationDate);
307 + $docProps->setModified($creationDate);
308 + break;
309 + case 'user-defined' :
310 + list(,$attrName) = explode(':',$attributes['name']);
311 + switch ($attrName) {
312 + case 'publisher' :
313 + $docProps->setCompany(trim($propertyValue));
314 + break;
315 + case 'category' :
316 + $docProps->setCategory(trim($propertyValue));
317 + break;
318 + case 'manager' :
319 + $docProps->setManager(trim($propertyValue));
320 + break;
321 + }
322 + break;
323 + }
324 + }
325 + }
326 + } elseif (isset($gnmXML->Summary)) {
327 + foreach($gnmXML->Summary->Item as $summaryItem) {
328 + $propertyName = $summaryItem->name;
329 + $propertyValue = $summaryItem->{'val-string'};
330 + switch ($propertyName) {
331 + case 'title' :
332 + $docProps->setTitle(trim($propertyValue));
333 + break;
334 + case 'comments' :
335 + $docProps->setDescription(trim($propertyValue));
336 + break;
337 + case 'keywords' :
338 + $docProps->setKeywords(trim($propertyValue));
339 + break;
340 + case 'category' :
341 + $docProps->setCategory(trim($propertyValue));
342 + break;
343 + case 'manager' :
344 + $docProps->setManager(trim($propertyValue));
345 + break;
346 + case 'author' :
347 + $docProps->setCreator(trim($propertyValue));
348 + $docProps->setLastModifiedBy(trim($propertyValue));
349 + break;
350 + case 'company' :
351 + $docProps->setCompany(trim($propertyValue));
352 + break;
353 + }
354 + }
355 + }
346 356
347 - $maxRow = $maxCol = 0;
357 + $worksheetID = 0;
358 + foreach($gnmXML->Sheets->Sheet as $sheet) {
359 + $worksheetName = (string) $sheet->Name;
360 +// echo '<b>Worksheet: ',$worksheetName,'</b><br />';
361 + if ((isset($this->_loadSheetsOnly)) && (!in_array($worksheetName, $this->_loadSheetsOnly))) {
362 + continue;
363 + }
348 364
349 - // Create new Worksheet
350 - $objPHPExcel->createSheet();
351 - $objPHPExcel->setActiveSheetIndex($worksheetID);
352 - // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
353 - // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
354 - // name in line with the formula, not the reverse
355 - $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
365 + $maxRow = $maxCol = 0;
356 366
357 - if ((!$this->readDataOnly) && (isset($sheet->PrintInformation))) {
358 - if (isset($sheet->PrintInformation->Margins)) {
359 - foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) {
360 - $marginAttributes = $margin->attributes();
361 - $marginSize = 72 / 100; // Default
362 - switch ($marginAttributes['PrefUnit']) {
363 - case 'mm':
364 - $marginSize = intval($marginAttributes['Points']) / 100;
365 - break;
366 - }
367 - switch ($key) {
368 - case 'top':
369 - $objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
370 - break;
371 - case 'bottom':
372 - $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
373 - break;
374 - case 'left':
375 - $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
376 - break;
377 - case 'right':
378 - $objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
379 - break;
380 - case 'header':
381 - $objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
382 - break;
383 - case 'footer':
384 - $objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
385 - break;
386 - }
387 - }
388 - }
389 - }
367 + // Create new Worksheet
368 + $objPHPExcel->createSheet();
369 + $objPHPExcel->setActiveSheetIndex($worksheetID);
370 + // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
371 + // cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
372 + // name in line with the formula, not the reverse
373 + $objPHPExcel->getActiveSheet()->setTitle($worksheetName,false);
390 374
391 - foreach ($sheet->Cells->Cell as $cell) {
392 - $cellAttributes = $cell->attributes();
393 - $row = (int) $cellAttributes->Row + 1;
394 - $column = (int) $cellAttributes->Col;
375 + if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
376 + if (isset($sheet->PrintInformation->Margins)) {
377 + foreach($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
378 + $marginAttributes = $margin->attributes();
379 + $marginSize = 72 / 100; // Default
380 + switch($marginAttributes['PrefUnit']) {
381 + case 'mm' :
382 + $marginSize = intval($marginAttributes['Points']) / 100;
383 + break;
384 + }
385 + switch($key) {
386 + case 'top' :
387 + $objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
388 + break;
389 + case 'bottom' :
390 + $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
391 + break;
392 + case 'left' :
393 + $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
394 + break;
395 + case 'right' :
396 + $objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
397 + break;
398 + case 'header' :
399 + $objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
400 + break;
401 + case 'footer' :
402 + $objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
403 + break;
404 + }
405 + }
406 + }
407 + }
395 408
396 - if ($row > $maxRow) {
397 - $maxRow = $row;
398 - }
399 - if ($column > $maxCol) {
400 - $maxCol = $column;
401 - }
409 + foreach($sheet->Cells->Cell as $cell) {
410 + $cellAttributes = $cell->attributes();
411 + $row = (int) $cellAttributes->Row + 1;
412 + $column = (int) $cellAttributes->Col;
402 413
403 - $column = PHPExcel_Cell::stringFromColumnIndex($column);
414 + if ($row > $maxRow) $maxRow = $row;
415 + if ($column > $maxCol) $maxCol = $column;
404 416
405 - // Read cell?
406 - if ($this->getReadFilter() !== null) {
407 - if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
408 - continue;
409 - }
410 - }
417 + $column = PHPExcel_Cell::stringFromColumnIndex($column);
411 418
412 - $ValueType = $cellAttributes->ValueType;
413 - $ExprID = (string) $cellAttributes->ExprID;
414 -// echo 'Cell ', $column, $row,'<br />';
415 -// echo 'Type is ', $ValueType,'<br />';
416 -// echo 'Value is ', $cell,'<br />';
417 - $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
418 - if ($ExprID > '') {
419 - if (((string) $cell) > '') {
420 - $this->expressions[$ExprID] = array(
421 - 'column' => $cellAttributes->Col,
422 - 'row' => $cellAttributes->Row,
423 - 'formula' => (string) $cell
424 - );
425 -// echo 'NEW EXPRESSION ', $ExprID,'<br />';
426 - } else {
427 - $expression = $this->expressions[$ExprID];
419 + // Read cell?
420 + if ($this->getReadFilter() !== NULL) {
421 + if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
422 + continue;
423 + }
424 + }
428 425
429 - $cell = $this->referenceHelper->updateFormulaReferences(
430 - $expression['formula'],
431 - 'A1',
432 - $cellAttributes->Col - $expression['column'],
433 - $cellAttributes->Row - $expression['row'],
434 - $worksheetName
435 - );
436 -// echo 'SHARED EXPRESSION ', $ExprID,'<br />';
437 -// echo 'New Value is ', $cell,'<br />';
438 - }
439 - $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
440 - } else {
441 - switch ($ValueType) {
442 - case '10': // NULL
443 - $type = PHPExcel_Cell_DataType::TYPE_NULL;
444 - break;
445 - case '20': // Boolean
446 - $type = PHPExcel_Cell_DataType::TYPE_BOOL;
447 - $cell = ($cell == 'TRUE') ? true: false;
448 - break;
449 - case '30': // Integer
450 - $cell = intval($cell);
451 - // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case
452 - case '40': // Float
453 - $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
454 - break;
455 - case '50': // Error
456 - $type = PHPExcel_Cell_DataType::TYPE_ERROR;
457 - break;
458 - case '60': // String
459 - $type = PHPExcel_Cell_DataType::TYPE_STRING;
460 - break;
461 - case '70': // Cell Range
462 - case '80': // Array
463 - }
464 - }
465 - $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
466 - }
426 + $ValueType = $cellAttributes->ValueType;
427 + $ExprID = (string) $cellAttributes->ExprID;
428 +// echo 'Cell ',$column,$row,'<br />';
429 +// echo 'Type is ',$ValueType,'<br />';
430 +// echo 'Value is ',$cell,'<br />';
431 + $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
432 + if ($ExprID > '') {
433 + if (((string) $cell) > '') {
467 434
468 - if ((!$this->readDataOnly) && (isset($sheet->Objects))) {
469 - foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
470 - $commentAttributes = $comment->attributes();
471 - // Only comment objects are handled at the moment
472 - if ($commentAttributes->Text) {
473 - $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->parseRichText((string)$commentAttributes->Text));
474 - }
475 - }
476 - }
477 -// echo '$maxCol=', $maxCol,'; $maxRow=', $maxRow,'<br />';
435 + $this->_expressions[$ExprID] = array( 'column' => $cellAttributes->Col,
436 + 'row' => $cellAttributes->Row,
437 + 'formula' => (string) $cell
438 + );
439 +// echo 'NEW EXPRESSION ',$ExprID,'<br />';
440 + } else {
441 + $expression = $this->_expressions[$ExprID];
442 +
443 + $cell = $this->_referenceHelper->updateFormulaReferences( $expression['formula'],
444 + 'A1',
445 + $cellAttributes->Col - $expression['column'],
446 + $cellAttributes->Row - $expression['row'],
447 + $worksheetName
448 + );
449 +// echo 'SHARED EXPRESSION ',$ExprID,'<br />';
450 +// echo 'New Value is ',$cell,'<br />';
451 + }
452 + $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
453 + } else {
454 + switch($ValueType) {
455 + case '10' : // NULL
456 + $type = PHPExcel_Cell_DataType::TYPE_NULL;
457 + break;
458 + case '20' : // Boolean
459 + $type = PHPExcel_Cell_DataType::TYPE_BOOL;
460 + $cell = ($cell == 'TRUE') ? True : False;
461 + break;
462 + case '30' : // Integer
463 + $cell = intval($cell);
464 + case '40' : // Float
465 + $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
466 + break;
467 + case '50' : // Error
468 + $type = PHPExcel_Cell_DataType::TYPE_ERROR;
469 + break;
470 + case '60' : // String
471 + $type = PHPExcel_Cell_DataType::TYPE_STRING;
472 + break;
473 + case '70' : // Cell Range
474 + case '80' : // Array
475 + }
476 + }
477 + $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell,$type);
478 + }
479 +
480 + if ((!$this->_readDataOnly) && (isset($sheet->Objects))) {
481 + foreach($sheet->Objects->children('gnm',TRUE) as $key => $comment) {
482 + $commentAttributes = $comment->attributes();
483 + // Only comment objects are handled at the moment
484 + if ($commentAttributes->Text) {
485 + $objPHPExcel->getActiveSheet()->getComment( (string)$commentAttributes->ObjectBound )
486 + ->setAuthor( (string)$commentAttributes->Author )
487 + ->setText($this->_parseRichText((string)$commentAttributes->Text) );
488 + }
489 + }
490 + }
491 +// echo '$maxCol=',$maxCol,'; $maxRow=',$maxRow,'<br />';
478 492 //
479 - foreach ($sheet->Styles->StyleRegion as $styleRegion) {
480 - $styleAttributes = $styleRegion->attributes();
481 - if (($styleAttributes['startRow'] <= $maxRow) &&
482 - ($styleAttributes['startCol'] <= $maxCol)) {
483 - $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
484 - $startRow = $styleAttributes['startRow'] + 1;
493 + foreach($sheet->Styles->StyleRegion as $styleRegion) {
494 + $styleAttributes = $styleRegion->attributes();
495 + if (($styleAttributes['startRow'] <= $maxRow) &&
496 + ($styleAttributes['startCol'] <= $maxCol)) {
485 497
486 - $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
487 - $endColumn = PHPExcel_Cell::stringFromColumnIndex($endColumn);
488 - $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
489 - $endRow += 1;
490 - $cellRange = $startColumn.$startRow.':'.$endColumn.$endRow;
491 -// echo $cellRange,'<br />';
498 + $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
499 + $startRow = $styleAttributes['startRow'] + 1;
492 500
493 - $styleAttributes = $styleRegion->Style->attributes();
494 -// var_dump($styleAttributes);
495 -// echo '<br />';
501 + $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
502 + $endColumn = PHPExcel_Cell::stringFromColumnIndex($endColumn);
503 + $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
504 + $endRow += 1;
505 + $cellRange = $startColumn.$startRow.':'.$endColumn.$endRow;
506 +// echo $cellRange,'<br />';
496 507
497 - // We still set the number format mask for date/time values, even if readDataOnly is true
498 - if ((!$this->readDataOnly) ||
499 - (PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
500 - $styleArray = array();
501 - $styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
502 - // If readDataOnly is false, we set all formatting information
503 - if (!$this->readDataOnly) {
504 - switch ($styleAttributes['HAlign']) {
505 - case '1':
506 - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
507 - break;
508 - case '2':
509 - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
510 - break;
511 - case '4':
512 - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
513 - break;
514 - case '8':
515 - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
516 - break;
517 - case '16':
518 - case '64':
519 - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
520 - break;
521 - case '32':
522 - $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
523 - break;
524 - }
508 + $styleAttributes = $styleRegion->Style->attributes();
509 +// var_dump($styleAttributes);
510 +// echo '<br />';
525 511
526 - switch ($styleAttributes['VAlign']) {
527 - case '1':
528 - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
529 - break;
530 - case '2':
531 - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
532 - break;
533 - case '4':
534 - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
535 - break;
536 - case '8':
537 - $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
538 - break;
539 - }
512 + // We still set the number format mask for date/time values, even if _readDataOnly is true
513 + if ((!$this->_readDataOnly) ||
514 + (PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
515 + $styleArray = array();
516 + $styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
517 + // If _readDataOnly is false, we set all formatting information
518 + if (!$this->_readDataOnly) {
519 + switch($styleAttributes['HAlign']) {
520 + case '1' :
521 + $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
522 + break;
523 + case '2' :
524 + $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
525 + break;
526 + case '4' :
527 + $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
528 + break;
529 + case '8' :
530 + $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
531 + break;
532 + case '16' :
533 + case '64' :
534 + $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
535 + break;
536 + case '32' :
537 + $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
538 + break;
539 + }
540 540
541 - $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
542 - $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
543 - $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
541 + switch($styleAttributes['VAlign']) {
542 + case '1' :
543 + $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
544 + break;
545 + case '2' :
546 + $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
547 + break;
548 + case '4' :
549 + $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
550 + break;
551 + case '8' :
552 + $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
553 + break;
554 + }
544 555
545 - $RGB = self::parseGnumericColour($styleAttributes["Fore"]);
546 - $styleArray['font']['color']['rgb'] = $RGB;
547 - $RGB = self::parseGnumericColour($styleAttributes["Back"]);
548 - $shade = $styleAttributes["Shade"];
549 - if (($RGB != '000000') || ($shade != '0')) {
550 - $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
551 - $RGB2 = self::parseGnumericColour($styleAttributes["PatternColor"]);
552 - $styleArray['fill']['endcolor']['rgb'] = $RGB2;
553 - switch ($shade) {
554 - case '1':
555 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
556 - break;
557 - case '2':
558 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
559 - break;
560 - case '3':
561 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
562 - break;
563 - case '4':
564 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
565 - break;
566 - case '5':
567 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
568 - break;
569 - case '6':
570 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
571 - break;
572 - case '7':
573 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
574 - break;
575 - case '8':
576 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
577 - break;
578 - case '9':
579 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
580 - break;
581 - case '10':
582 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
583 - break;
584 - case '11':
585 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
586 - break;
587 - case '12':
588 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
589 - break;
590 - case '13':
591 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
592 - break;
593 - case '14':
594 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
595 - break;
596 - case '15':
597 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
598 - break;
599 - case '16':
600 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
601 - break;
602 - case '17':
603 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
604 - break;
605 - case '18':
606 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
607 - break;
608 - case '19':
609 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
610 - break;
611 - case '20':
612 - $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
613 - break;
614 - }
615 - }
556 + $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? True : False;
557 + $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? True : False;
558 + $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
616 559
617 - $fontAttributes = $styleRegion->Style->Font->attributes();
618 -// var_dump($fontAttributes);
619 -// echo '<br />';
620 - $styleArray['font']['name'] = (string) $styleRegion->Style->Font;
621 - $styleArray['font']['size'] = intval($fontAttributes['Unit']);
622 - $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
623 - $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
624 - $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
625 - switch ($fontAttributes['Underline']) {
626 - case '1':
627 - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
628 - break;
629 - case '2':
630 - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
631 - break;
632 - case '3':
633 - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
634 - break;
635 - case '4':
636 - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
637 - break;
638 - default:
639 - $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
640 - break;
641 - }
642 - switch ($fontAttributes['Script']) {
643 - case '1':
644 - $styleArray['font']['superScript'] = true;
645 - break;
646 - case '-1':
647 - $styleArray['font']['subScript'] = true;
648 - break;
649 - }
560 + $RGB = self::_parseGnumericColour($styleAttributes["Fore"]);
561 + $styleArray['font']['color']['rgb'] = $RGB;
562 + $RGB = self::_parseGnumericColour($styleAttributes["Back"]);
563 + $shade = $styleAttributes["Shade"];
564 + if (($RGB != '000000') || ($shade != '0')) {
565 + $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
566 + $RGB2 = self::_parseGnumericColour($styleAttributes["PatternColor"]);
567 + $styleArray['fill']['endcolor']['rgb'] = $RGB2;
568 + switch($shade) {
569 + case '1' :
570 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
571 + break;
572 + case '2' :
573 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
574 + break;
575 + case '3' :
576 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
577 + break;
578 + case '4' :
579 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
580 + break;
581 + case '5' :
582 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
583 + break;
584 + case '6' :
585 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
586 + break;
587 + case '7' :
588 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
589 + break;
590 + case '8' :
591 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
592 + break;
593 + case '9' :
594 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
595 + break;
596 + case '10' :
597 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
598 + break;
599 + case '11' :
600 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
601 + break;
602 + case '12' :
603 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
604 + break;
605 + case '13' :
606 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
607 + break;
608 + case '14' :
609 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
610 + break;
611 + case '15' :
612 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
613 + break;
614 + case '16' :
615 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
616 + break;
617 + case '17' :
618 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
619 + break;
620 + case '18' :
621 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
622 + break;
623 + case '19' :
624 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
625 + break;
626 + case '20' :
627 + $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
628 + break;
629 + }
630 + }
650 631
651 - if (isset($styleRegion->Style->StyleBorder)) {
652 - if (isset($styleRegion->Style->StyleBorder->Top)) {
653 - $styleArray['borders']['top'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes());
654 - }
655 - if (isset($styleRegion->Style->StyleBorder->Bottom)) {
656 - $styleArray['borders']['bottom'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes());
657 - }
658 - if (isset($styleRegion->Style->StyleBorder->Left)) {
659 - $styleArray['borders']['left'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes());
660 - }
661 - if (isset($styleRegion->Style->StyleBorder->Right)) {
662 - $styleArray['borders']['right'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes());
663 - }
664 - if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) {
665 - $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
666 - $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH;
667 - } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) {
668 - $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
669 - $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP;
670 - } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) {
671 - $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes());
672 - $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
673 - }
674 - }
675 - if (isset($styleRegion->Style->HyperLink)) {
676 - // TO DO
677 - $hyperlink = $styleRegion->Style->HyperLink->attributes();
678 - }
679 - }
680 -// var_dump($styleArray);
681 -// echo '<br />';
682 - $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray);
683 - }
684 - }
685 - }
632 + $fontAttributes = $styleRegion->Style->Font->attributes();
633 +// var_dump($fontAttributes);
634 +// echo '<br />';
635 + $styleArray['font']['name'] = (string) $styleRegion->Style->Font;
636 + $styleArray['font']['size'] = intval($fontAttributes['Unit']);
637 + $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? True : False;
638 + $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? True : False;
639 + $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? True : False;
640 + switch($fontAttributes['Underline']) {
641 + case '1' :
642 + $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
643 + break;
644 + case '2' :
645 + $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
646 + break;
647 + case '3' :
648 + $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
649 + break;
650 + case '4' :
651 + $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
652 + break;
653 + default :
654 + $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
655 + break;
656 + }
657 + switch($fontAttributes['Script']) {
658 + case '1' :
659 + $styleArray['font']['superScript'] = True;
660 + break;
661 + case '-1' :
662 + $styleArray['font']['subScript'] = True;
663 + break;
664 + }
686 665
687 - if ((!$this->readDataOnly) && (isset($sheet->Cols))) {
688 - // Column Widths
689 - $columnAttributes = $sheet->Cols->attributes();
690 - $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
691 - $c = 0;
692 - foreach ($sheet->Cols->ColInfo as $columnOverride) {
693 - $columnAttributes = $columnOverride->attributes();
694 - $column = $columnAttributes['No'];
695 - $columnWidth = $columnAttributes['Unit'] / 5.4;
696 - $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false;
697 - $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1;
698 - while ($c < $column) {
699 - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
700 - ++$c;
701 - }
702 - while (($c < ($column+$columnCount)) && ($c <= $maxCol)) {
703 - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth);
704 - if ($hidden) {
705 - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false);
706 - }
707 - ++$c;
708 - }
709 - }
710 - while ($c <= $maxCol) {
711 - $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
712 - ++$c;
713 - }
714 - }
666 + if (isset($styleRegion->Style->StyleBorder)) {
667 + if (isset($styleRegion->Style->StyleBorder->Top)) {
668 + $styleArray['borders']['top'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes());
669 + }
670 + if (isset($styleRegion->Style->StyleBorder->Bottom)) {
671 + $styleArray['borders']['bottom'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes());
672 + }
673 + if (isset($styleRegion->Style->StyleBorder->Left)) {
674 + $styleArray['borders']['left'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes());
675 + }
676 + if (isset($styleRegion->Style->StyleBorder->Right)) {
677 + $styleArray['borders']['right'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes());
678 + }
679 + if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) {
680 + $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
681 + $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH;
682 + } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) {
683 + $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
684 + $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP;
685 + } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) {
686 + $styleArray['borders']['diagonal'] = self::_parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes());
687 + $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
688 + }
689 + }
690 + if (isset($styleRegion->Style->HyperLink)) {
691 + // TO DO
692 + $hyperlink = $styleRegion->Style->HyperLink->attributes();
693 + }
694 + }
695 +// var_dump($styleArray);
696 +// echo '<br />';
697 + $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray);
698 + }
699 + }
700 + }
715 701
716 - if ((!$this->readDataOnly) && (isset($sheet->Rows))) {
717 - // Row Heights
718 - $rowAttributes = $sheet->Rows->attributes();
719 - $defaultHeight = $rowAttributes['DefaultSizePts'];
720 - $r = 0;
702 + if ((!$this->_readDataOnly) && (isset($sheet->Cols))) {
703 + // Column Widths
704 + $columnAttributes = $sheet->Cols->attributes();
705 + $defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
706 + $c = 0;
707 + foreach($sheet->Cols->ColInfo as $columnOverride) {
708 + $columnAttributes = $columnOverride->attributes();
709 + $column = $columnAttributes['No'];
710 + $columnWidth = $columnAttributes['Unit'] / 5.4;
711 + $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false;
712 + $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1;
713 + while ($c < $column) {
714 + $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
715 + ++$c;
716 + }
717 + while (($c < ($column+$columnCount)) && ($c <= $maxCol)) {
718 + $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth);
719 + if ($hidden) {
720 + $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false);
721 + }
722 + ++$c;
723 + }
724 + }
725 + while ($c <= $maxCol) {
726 + $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
727 + ++$c;
728 + }
729 + }
721 730
722 - foreach ($sheet->Rows->RowInfo as $rowOverride) {
723 - $rowAttributes = $rowOverride->attributes();
724 - $row = $rowAttributes['No'];
725 - $rowHeight = $rowAttributes['Unit'];
726 - $hidden = ((isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1')) ? true : false;
727 - $rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1;
728 - while ($r < $row) {
729 - ++$r;
730 - $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
731 - }
732 - while (($r < ($row+$rowCount)) && ($r < $maxRow)) {
733 - ++$r;
734 - $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight);
735 - if ($hidden) {
736 - $objPHPExcel->getActiveSheet()->getRowDimension($r)->setVisible(false);
737 - }
738 - }
739 - }
740 - while ($r < $maxRow) {
741 - ++$r;
742 - $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
743 - }
744 - }
731 + if ((!$this->_readDataOnly) && (isset($sheet->Rows))) {
732 + // Row Heights
733 + $rowAttributes = $sheet->Rows->attributes();
734 + $defaultHeight = $rowAttributes['DefaultSizePts'];
735 + $r = 0;
745 736
746 - // Handle Merged Cells in this worksheet
747 - if (isset($sheet->MergedRegions)) {
748 - foreach ($sheet->MergedRegions->Merge as $mergeCells) {
749 - if (strpos($mergeCells, ':') !== false) {
750 - $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
751 - }
752 - }
753 - }
737 + foreach($sheet->Rows->RowInfo as $rowOverride) {
738 + $rowAttributes = $rowOverride->attributes();
739 + $row = $rowAttributes['No'];
740 + $rowHeight = $rowAttributes['Unit'];
741 + $hidden = ((isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1')) ? true : false;
742 + $rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1;
743 + while ($r < $row) {
744 + ++$r;
745 + $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
746 + }
747 + while (($r < ($row+$rowCount)) && ($r < $maxRow)) {
748 + ++$r;
749 + $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight);
750 + if ($hidden) {
751 + $objPHPExcel->getActiveSheet()->getRowDimension($r)->setVisible(false);
752 + }
753 + }
754 + }
755 + while ($r < $maxRow) {
756 + ++$r;
757 + $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
758 + }
759 + }
754 760
755 - $worksheetID++;
756 - }
761 + // Handle Merged Cells in this worksheet
762 + if (isset($sheet->MergedRegions)) {
763 + foreach($sheet->MergedRegions->Merge as $mergeCells) {
764 + if (strpos($mergeCells,':') !== FALSE) {
765 + $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
766 + }
767 + }
768 + }
757 769
758 - // Loop through definedNames (global named ranges)
759 - if (isset($gnmXML->Names)) {
760 - foreach ($gnmXML->Names->Name as $namedRange) {
761 - $name = (string) $namedRange->name;
762 - $range = (string) $namedRange->value;
763 - if (stripos($range, '#REF!') !== false) {
764 - continue;
765 - }
770 + $worksheetID++;
771 + }
766 772
767 - $range = explode('!', $range);
768 - $range[0] = trim($range[0], "'");
769 - if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
770 - $extractedRange = str_replace('$', '', $range[1]);
771 - $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
772 - }
773 - }
774 - }
773 + // Loop through definedNames (global named ranges)
774 + if (isset($gnmXML->Names)) {
775 + foreach($gnmXML->Names->Name as $namedRange) {
776 + $name = (string) $namedRange->name;
777 + $range = (string) $namedRange->value;
778 + if (stripos($range, '#REF!') !== false) {
779 + continue;
780 + }
775 781
776 - // Return
777 - return $objPHPExcel;
778 - }
782 + $range = explode('!',$range);
783 + $range[0] = trim($range[0],"'");;
784 + if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
785 + $extractedRange = str_replace('$', '', $range[1]);
786 + $objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) );
787 + }
788 + }
789 + }
779 790
780 - private static function parseBorderAttributes($borderAttributes)
781 - {
782 - $styleArray = array();
783 - if (isset($borderAttributes["Color"])) {
784 - $styleArray['color']['rgb'] = self::parseGnumericColour($borderAttributes["Color"]);
785 - }
786 791
787 - switch ($borderAttributes["Style"]) {
788 - case '0':
789 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
790 - break;
791 - case '1':
792 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
793 - break;
794 - case '2':
795 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
796 - break;
797 - case '3':
798 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
799 - break;
800 - case '4':
801 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
802 - break;
803 - case '5':
804 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
805 - break;
806 - case '6':
807 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
808 - break;
809 - case '7':
810 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
811 - break;
812 - case '8':
813 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
814 - break;
815 - case '9':
816 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
817 - break;
818 - case '10':
819 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
820 - break;
821 - case '11':
822 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
823 - break;
824 - case '12':
825 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
826 - break;
827 - case '13':
828 - $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
829 - break;
830 - }
831 - return $styleArray;
832 - }
792 + // Return
793 + return $objPHPExcel;
794 + }
833 795
834 - private function parseRichText($is = '')
835 - {
836 - $value = new PHPExcel_RichText();
837 - $value->createText($is);
838 796
839 - return $value;
840 - }
797 + private static function _parseBorderAttributes($borderAttributes)
798 + {
799 + $styleArray = array();
841 800
842 - private static function parseGnumericColour($gnmColour)
843 - {
844 - list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
845 - $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
846 - $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
847 - $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2);
848 - return $gnmR . $gnmG . $gnmB;
849 - }
801 + if (isset($borderAttributes["Color"])) {
802 + $RGB = self::_parseGnumericColour($borderAttributes["Color"]);
803 + $styleArray['color']['rgb'] = $RGB;
804 + }
805 +
806 + switch ($borderAttributes["Style"]) {
807 + case '0' :
808 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
809 + break;
810 + case '1' :
811 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
812 + break;
813 + case '2' :
814 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
815 + break;
816 + case '4' :
817 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
818 + break;
819 + case '5' :
820 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
821 + break;
822 + case '6' :
823 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
824 + break;
825 + case '7' :
826 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
827 + break;
828 + case '9' :
829 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
830 + break;
831 + case '10' :
832 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
833 + break;
834 + case '11' :
835 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
836 + break;
837 + case '12' :
838 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
839 + break;
840 + case '13' :
841 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
842 + break;
843 + case '3' :
844 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
845 + break;
846 + case '8' :
847 + $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
848 + break;
849 + }
850 + return $styleArray;
851 + }
852 +
853 +
854 + private function _parseRichText($is = '') {
855 + $value = new PHPExcel_RichText();
856 +
857 + $value->createText($is);
858 +
859 + return $value;
860 + }
861 +
862 +
863 + private static function _parseGnumericColour($gnmColour) {
864 + list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour);
865 + $gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);
866 + $gnmG = substr(str_pad($gnmG,4,'0',STR_PAD_RIGHT),0,2);
867 + $gnmB = substr(str_pad($gnmB,4,'0',STR_PAD_RIGHT),0,2);
868 + $RGB = $gnmR.$gnmG.$gnmB;
869 +// echo 'Excel Colour: ',$RGB,'<br />';
870 + return $RGB;
871 + }
872 +
850 873 }