File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -631,17 +631,33 @@ $spreadsheet->getActiveSheet()->getCell('A1')
631631You can make a cell a clickable URL by setting its hyperlink property:
632632
633633``` php
634- $spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
635- $spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('https://www.example.com');
634+ $spreadsheet->getActiveSheet()->setCellValue('E26', 'www.example.com');
635+ $spreadsheet->getActiveSheet()->getCell('E26')
636+ ->getHyperlink()
637+ ->setUrl('https://www.example.com');
636638```
637639
638640If you want to make a hyperlink to another worksheet/cell, use the
639641following code:
640642
641643``` php
642- $spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
643- $spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl("sheet://'Sheetname'!A1");
644+ $spreadsheet->getActiveSheet()
645+ ->setCellValue('E27', 'go to another sheet');
646+ $spreadsheet->getActiveSheet()->getCell('E27')
647+ ->getHyperlink()
648+ ->setUrl("sheet://'Sheetname'!A1");
649+ ```
650+
651+ Excel automatically supplies a special style when a hyperlink is
652+ entered into a cell. PhpSpreadsheet cannot do so. However, you
653+ can mimic Excel's behavior with:
654+ ``` php
655+ $spreadsheet->getActiveSheet()
656+ ->getStyle('E26')
657+ ->getFont()
658+ ->setHyperlinkTheme();
644659```
660+ This will set underline (all formats) and text color (Xlsx only).
645661
646662## Setting Printer Options for Excel files
647663
You can’t perform that action at this time.
0 commit comments