0

I have a text with hyperlink(s) as below.

Please click <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;cmd=Retrieve&amp;dopt=Abstract&amp;list_uids=8395787">here</a> or <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;cmd=Retrieve&amp;dopt=Abstract&amp;list_uids=9568930">here</a> for more info.

But when I write the text into a cell with the Perl module's write() method, the text in the cell is displayed as a plain text as shown above. So my question is how I can write the text into a cell so it will be displayed as a HTML text with the hyperlinks being clickable as below.

Please click here or here for more info.

Here are the codes of a simple Perl script that creates an xlsx file with a single cell containing the text with hyperlinks. Thanks.

#!/usr/bin/perl

use strict;
use Excel::Writer::XLSX;

my ($wb, $ws, $format1, $format2, $f_url, $rn);

my $wb = Excel::Writer::XLSX->new('/data/tmp/reference.xlsx');
my $ws = $wb->add_worksheet();
my $format = $wb->add_format(align => 'left');
my $text = 'Please click <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;cmd=Retrieve&amp;dopt=Abstract&amp;list_uids=8395787">here</a> or <a href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;cmd=Retrieve&amp;dopt=Abstract&amp;list_uids=9568930" target=_blank>here</a> for more info.';
$ws->write(0, 0, $text, $format);
$wb->close();

exit 0;
toolic
  • 57,801
  • 17
  • 75
  • 117
Shiping
  • 1,203
  • 2
  • 11
  • 21

1 Answers1

2

Unfortunately that isn’t possible in Excel (and hence not in Excel::Writer::XLSX). It is only possible to have one hyperlink per cell.

jmcnamara
  • 38,196
  • 6
  • 90
  • 108