PHP_XLSXWriter icon indicating copy to clipboard operation
PHP_XLSXWriter copied to clipboard

support for setting Cell Hyperlinks

Open shaun-madison opened this issue 7 years ago • 4 comments

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.

shaun-madison avatar May 03 '17 14:05 shaun-madison

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.

mk-j avatar May 03 '17 18:05 mk-j

duplicate of #74

mk-j avatar May 19 '17 17:05 mk-j

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: image

example-hyperlink.xlsx

Yursksf1 avatar Apr 12 '18 15:04 Yursksf1

How to add multiple links in one cell?

hhh062001 avatar Dec 04 '20 00:12 hhh062001

I added an ex12-hyperlink.php showing an example with hyperlinks.

mk-j avatar May 31 '23 17:05 mk-j