PHP_XLSXWriter
PHP_XLSXWriter copied to clipboard
support for setting Cell Hyperlinks
do you have any plans for adding support for Cell Hyperlinks? As all the openxml infrastructure is there it would be seem reasonably straight forward to add this useful capability.
Thanks for your interest in this project, there seems to be significant interest in this feature. We might look at adding the functionality in the coming months.
duplicate of #74
Hi, look this example
<?php
set_include_path( get_include_path().PATH_SEPARATOR."..");
include_once("xlsxwriter.class.php");
// integer is Int, price is float
$header = array(
'name'=>'string',
'link'=>'string',
'hiperlink'=>'string',
);
$data1 = array(
array('Google','www.google.com','=HYPERLINK("http://www.google.com","Google")'),
array('Facebook','www.facebook.com','=HYPERLINK("http://www.facebook.com","Facebook")'),
array('GitHub','www.github.com','=HYPERLINK("http://www.github.com","GitHub")'),
array('LinkedIn','www.linkedin.com','=HYPERLINK("http://www.linkedin.com","Linkedin")'),
array('Twitter','www.twitter.com','=HYPERLINK("http://www.twitter.com","Twitter")'),
);
$writer = new XLSXWriter();
$writer->writeSheetHeader('Sheet1', $header);
foreach($data1 as $row)
$writer->writeSheetRow('Sheet1', $row);
$writer->writeToFile('example-hyperlink.xlsx');
//$writer->writeToStdOut();
//echo $writer->writeToString();
exit(0);
Result:
How to add multiple links in one cell?
I added an ex12-hyperlink.php showing an example with hyperlinks.