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')
631
631
You can make a cell a clickable URL by setting its hyperlink property:
632
632
633
633
``` 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');
636
638
```
637
639
638
640
If you want to make a hyperlink to another worksheet/cell, use the
639
641
following code:
640
642
641
643
``` 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();
644
659
```
660
+ This will set underline (all formats) and text color (Xlsx only).
645
661
646
662
## Setting Printer Options for Excel files
647
663
You can’t perform that action at this time.
0 commit comments