This commit is contained in:
Sergey Shuchkin 2021-06-08 09:51:10 +06:00
parent 8bfbe078db
commit 6abd0286bb
2 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,13 @@
# Changelog
## 1.0.14 (2021-06-08)
* Added *mailto* hyperlinks support (thx Howard Martin)
```php
SimpleXLSXGen::fromArray([
'Mailto hyperlink', '<a href="mailto:sergey.shuchkin@gmail.com">Please email me</a>'
])->saveAs('test.xlsx');
```
## 1.0.13 (2021-05-29)
* Fixed hyperlinks in several sheets

View File

@ -460,6 +460,10 @@ class SimpleXLSXGen {
$this->sheets[ $idx ]['hyperlinks'][] = ['ID' => 'rId' . ( count( $this->sheets[ $idx ]['hyperlinks'] ) + 1 ), 'R' => $cname, 'H' => $h[0], 'L' => isset( $h[1] ) ? $h[1] : ''];
$F = self::F_HYPERLINK; // Hyperlink
}
if ( preg_match( '/<a href="(mailto?:[^"]+)">(.*?)<\/a>/i', $v, $m ) ) {
$this->sheets[ $idx ]['hyperlinks'][] = ['ID' => 'rId' . ( count( $this->sheets[ $idx ]['hyperlinks'] ) + 1 ), 'R' => $cname, 'H' => $m[1], 'L' => ''];
$F = self::F_HYPERLINK; // mailto hyperlink
}
$v = strip_tags( $v );
} // tags
$vl = mb_strlen( $v );