11
$objPHPExcel->setActiveSheetIndex($i)->getCell('A' . $j)
->getHyperlink('mytext')
->setUrl('http://abc.com');

i am trying to link a specific part of text in cell, but its linking to a whole cell, is there any solution to do it? OR if i do it with multiple cells, is there any way to apply width of specific row in a sheet? e.g.

ROW1 CELL1 CELL2 CELL3 CELL4
ROW2 ----CELL1----CELL2----
ROW3 ----CELL1----CELL2----
ROW4 ----CELL1----CELL2----

Rizwan Yahya
  • 366
  • 3
  • 17
Jabeen
  • 357
  • 2
  • 4
  • 15
  • How would you set a hyperlink only on the text and not on the cell in MS Excel itself? – Mark Baker May 29 '13 at 15:45
  • is there any other solution. i have ID :3434 i want to add link on this number – Jabeen May 30 '13 at 09:30
  • 3
    I don't understand the problem.... I don't believe it's possible in MS Excel itself, so why should it be possible in PHPExcel? – Mark Baker May 30 '13 at 09:35
  • I came here with the same guestion, I don't know excel that well... @MarkBaker I think you should post your comment as an answer. – Marcel Burkhard Apr 09 '15 at 09:02
  • For the multiple cells part of the question: you can merge cells with PhpWord to get the result like you have illustrated (your question wasn't exactly this, but I assumed that you might be meaning this based on the illustration). – ejuhjav Jun 04 '15 at 07:27

1 Answers1

1

Can be achieved by using below code.

$objPHPExcel->setActiveSheetIndex($i)->SetCellValue(A1, 'mytext');
$objPHPExcel->setActiveSheetIndex($i)->getCell(A1)->getHyperlink()->setUrl('http://abc.co');
Dev001
  • 276
  • 1
  • 7
  • 25