Skip to content

Commit

Permalink
Merge pull request #34 from daveherman71/patch-1
Browse files Browse the repository at this point in the history
Add support for cell hyperlinks via _excel-link attribute
  • Loading branch information
sprain authored Nov 1, 2023
2 parents 9336982 + 243e476 commit 163ac2c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/HtmlPhpExcel/HtmlPhpExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ private function createExcel(): void
$excelWorksheet->getComment($excelCellIndex)->getText()->createText($cellComment);
}

// Set Url
$cellLink = $cell->getAttribute('_excel-link');
if ($cellLink = filter_var($cellLink, FILTER_SANITIZE_URL)) {
$excelWorksheet->getCell($excelCellIndex)->getHyperlink()->setUrl($cellLink);
}

// Merge cells
$colspan = $cell->getAttribute('colspan');
$rowspan = $cell->getAttribute('rowspan');
Expand Down

0 comments on commit 163ac2c

Please sign in to comment.