Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using PHP Excel library and have a problem.

I need to insert into a cell image as hyperlink. Is it possible, any suggesions?

Tryed to dran an image

        $image = imagecreatefromjpeg($imagePath);

        $objDrawing = new PHPExcel_Worksheet_MemoryDrawing();        
        $objDrawing->setImageResource($image);        

        $columnLetter = PHPExcel_Cell::stringFromColumnIndex($columnIndex - 1);

        $this->imageColumns[$columnLetter] = 1;

        $coordinate = $columnLetter . $rowIndex;

        $objDrawing->setCoordinates($coordinate);
        $objDrawing->setResizeProportional(false);
        $objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
        $objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);        
        $objDrawing->setWorksheet($this->objPHPExcel->getActiveSheet());
share|improve this question
You can't set an image as a hyperlink, but you can set the cell that it's overlaid on as a hyperlink – Mark Baker Apr 19 at 6:31
i found an example ->getCell()->getHyperlink()->setUrl('url'); – user1362776 Apr 19 at 7:06

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.