17 $this->worksheet = $workSheet;
22 foreach ($relsWorksheet->Relationship as $element) {
23 if ($element[
'Type'] ==
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink') {
24 $this->hyperlinks[(string) $element[
'Id']] = (
string) $element[
'Target'];
31 foreach ($worksheetXml->hyperlink as $hyperlink) {
32 if ($hyperlink !== null) {
41 $linkRel = $hyperlink->attributes(
'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
44 $cell = $worksheet->getCell($cellReference);
45 if (isset($linkRel[
'id'])) {
46 $hyperlinkUrl = $this->hyperlinks[(string) $linkRel[
'id']] ?? null;
47 if (isset($hyperlink[
'location'])) {
48 $hyperlinkUrl .=
'#' . (string) $hyperlink[
'location'];
51 } elseif (isset($hyperlink[
'location'])) {
52 $cell->getHyperlink()->setUrl(
'sheet://' . (
string) $hyperlink[
'location']);
56 if (isset($hyperlink[
'tooltip'])) {
57 $cell->getHyperlink()->setTooltip((
string) $hyperlink[
'tooltip']);
__construct(Worksheet $workSheet)
getHyperlink($pCellCoordinate)
Get hyperlink.
setHyperlink(SimpleXMLElement $hyperlink, Worksheet $worksheet)
readHyperlinks(SimpleXMLElement $relsWorksheet)
static extractAllCellReferencesInRange($cellRange)
Extract all cell references in range, which may be comprised of multiple cell ranges.
setHyperlinks(SimpleXMLElement $worksheetXml)