Excel2007 reader wasn't always reading the print_titles properly, fix courtesy of watermark86

This commit is contained in:
Mark Baker 2013-05-24 09:29:43 +01:00
parent de2248d1d4
commit b880b5ff9d
1 changed files with 3 additions and 2 deletions

View File

@ -1542,13 +1542,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// Set print titles
foreach ($extractedRange as $range) {
$matches = array();
$range = str_replace('$', '', $range);
// check for repeating columns, e g. 'A:A' or 'A:D'
if (preg_match('/^([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
}
// check for repeating rows, e.g. '1:1' or '1:5'
elseif (preg_match('/^(\d+)\:(\d+)$/', $range, $matches)) {
elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
$docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
}
}