PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 5, 2022

[FIXED] how to add multiple link in a cell with phpExcel

 October 05, 2022     hyperlink, php, phpexcel, url     No comments   

Issue

I have a cell with multiple Link

+---------+---------+
|         |         |
| Cell 1  | Cell 2  |
|         |         |
+---------+---------+
|         | Link 1  |
|  ROW 1  | Link 2  |
|         | Link 3  |
+---------+---------+

how can I make this with phpExcel ? I know below code can set hyperlink to a cell but i don't know how can set multiple link to a cell!

$objPHPExcelExport->setActiveSheetIndex(0)
                    ->setCellValue('A'.$index, $row)
                    ->setCellValue('B'.$index, $link);
$objPHPExcelExport->getActiveSheet()
                    ->getCell('B'.$index)
                    ->getHyperlink()
                    ->setUrl('http://'.$url);

Solution

I'm not aware that you can.... how would you do it in MS Excel? As far as I know, MS Excel allows a single link for the cell, not links for indivdual text blocks within that cell.

Even using MS Excel's HYPERLINK() function, and creating a concatenated string combining all the links

=HYPERLINK("http://www.google.co.uk","GOOGLE")&CHAR(10)&HYPERLINK("http://www.amazon.co.uk","AMAZON")

doesn't achieve your objective.


So I don't beleive that what you want to do can be achieved in MS Excel; an if MS Exel doesn't allow it, then nor will PHPEexcel



Answered By - Mark Baker
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing