diff --git a/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php b/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php index be95a99f3..87c00a4a3 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php +++ b/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php @@ -44,14 +44,11 @@ class Hyperlinks $attributes = Xlsx::getAttributes($hyperlink); foreach (Coordinate::extractAllCellReferencesInRange($attributes->ref) as $cellReference) { $cell = $worksheet->getCell($cellReference); - if (isset($linkRel['id'])) { - $hyperlinkUrl = $this->hyperlinks[(string) $linkRel['id']] ?? ''; - if (isset($attributes['location'])) { - $hyperlinkUrl .= '#' . (string) $attributes['location']; - } - $cell->getHyperlink()->setUrl($hyperlinkUrl); - } elseif (isset($attributes['location'])) { + if (isset($attributes['location'])) { $cell->getHyperlink()->setUrl('sheet://' . (string) $attributes['location']); + } elseif (isset($linkRel['id'])) { + $hyperlinkUrl = $this->hyperlinks[(string) $linkRel['id']] ?? ''; + $cell->getHyperlink()->setUrl($hyperlinkUrl); } // Tooltip