From fd4161dcaa437e822dbe09c8013ae099eb2d7ee7 Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Wed, 21 Nov 2012 10:37:16 +0000 Subject: [PATCH] Bugfix: Work item 17976 - Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references --- Classes/PHPExcel/Reader/Excel2007.php | 9 ++++++--- changelog.txt | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php index 2324be5b..cf530ee1 100644 --- a/Classes/PHPExcel/Reader/Excel2007.php +++ b/Classes/PHPExcel/Reader/Excel2007.php @@ -1202,9 +1202,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE foreach (PHPExcel_Cell::extractAllCellReferencesInRange($hyperlink['ref']) as $cellReference) { $cell = $docSheet->getCell( $cellReference ); if (isset($linkRel['id'])) { - $cell->getHyperlink()->setUrl( $hyperlinks[ (string)$linkRel['id'] ] ); - } - if (isset($hyperlink['location'])) { + $hyperlinkUrl = $hyperlinks[ (string)$linkRel['id'] ]; + if (isset($hyperlink['location'])) { + $hyperlinkUrl .= '#' . (string) $hyperlink['location']; + } + $cell->getHyperlink()->setUrl($hyperlinkUrl); + } elseif (isset($hyperlink['location'])) { $cell->getHyperlink()->setUrl( 'sheet://' . (string)$hyperlink['location'] ); } diff --git a/changelog.txt b/changelog.txt index a1b8d132..399d5d1d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -29,6 +29,7 @@ Fixed in develop branch: - Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML - Bugfix: (AndreKR) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer - Bugfix: (MBaker) Work item GH-67 - Cache directory for DiscISAM cache storage cannot be set +- Bugfix: (MBaker) Work item 17976 - Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references - General: (kea) Work item GH-69 - Improved AdvancedValueBinder for currency - General: (MBaker) Work items 17936 and 17840 - Fix for environments where there is no access to /tmp but to upload_tmp_dir Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used @@ -38,6 +39,7 @@ Fixed in develop branch: - Bugfix: (MBaker) Work item 18844 - cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't - Bugfix: (Progi1984) Work item GH-22 - Sheet View in Excel5 Writer + -------------------------------------------------------------------------------- BREAKING CHANGE! As part of the planned changes for handling array formulae in workbooks, there are some changes that will affect the PHPExcel_Cell object