Skip to content

Commit

Permalink
Add support for cell hyperlinks via _excel-link attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
daveherman71 authored Oct 18, 2023
1 parent 4d5b053 commit 243e476
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 243e476

Please sign in to comment.