Hy, i'm having a problem with php excell, i have in my db a row that its have a full url, when i export it its not make it HYperlink, i've see the docs on the internet but unft its for only one cell not for entire column
this is the code

while ($row = mysql_fetch_object($result)) {

    $objPHPExcel->getActiveSheet()


                                    ->setCellValue('B11','Photo')

                                    ->setCellValue('B'.$rowNumber,$row->photo);////code for full url



       $rowNumber++;

}
Member Avatar for diafol

You seem to be overwriting B11 on every iteration too. That's pointless. Place it above the loop.

Where have you declared $rowNumber previously?

I'm assuming you have $rowNumber = 12 before the loop?

commented: yes its before loop rownumber +2

Did my answer from your other thread not help you? I have provided a tested working example there.

commented: He complained "Nothing helped him" - all yours broj :) +15

hy broj1, its for one cel that formula and i need for one entire column

Member Avatar for diafol

Did you try my suggestion?

yes its before loop rownumber

ive tested

->setCellValue('B'.$rowNumber,'=HYPERLINK($row->prodoto)')

its give me error

<br />
<b>Fatal error</b>:  Uncaught exception 'PHPExcel_Calculation_Exception' with message 'Worksheet!B12 -&gt; Formula Error: Unexpected operator '&gt;'' in /web/ì/admin/Classes/PHPExcel/Cell.php:300
Stack trace:
#0 /web/ì/Classes/PHPExcel/Writer/Excel5/Worksheet.php(460): PHPExcel_Cell-&gt;getCalculatedValue()
#1 /web/ì/Classes/PHPExcel/Writer/Excel5.php(187): PHPExcel_Writer_Excel5_Worksheet-&gt;close()
#2 /web/ì/admin/excell.php(135): PHPExcel_Writer_Excel5-&gt;save('php://output')
#3 {main}
  thrown in <b>/web/ì/Classes/PHPExcel/Cell.php</b> on line <b>300</b><br />

yes diafol, but nothing..error

Uncaught exception 'PHPExcel_Calculation_Exception' with message 'Worksheet!B12 -&gt; Formula Error: Unexpected operator '&gt;'' in /web/ì/admin/Classes/PHPExcel/Cell.php:300

It seems that PHPExcel tries to calculate the value in the cell and it can't since there is an invalid operator in there. Can you post what the value of $row->prodoto is when it throws the error.

->setCellValue('B'.$rowNumber,'=HYPERLINK($row->prodoto)')

I think you should use double quotes so $row->prodoto gets parsed (and also enclose the variable in curly braces to be on the safe side):

->setCellValue('B'.$rowNumber,"=HYPERLINK({$row->prodoto})")

thx broj1,but i've solved inserted already in db =HYPERLINK("google.ro";"link")

OK. Please mark s solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.