cv列包含上传到服务器的文件的文件名。 如何使用链接包装单元格值以从服务器中提取文件。
这是我的代码。
$sql = "SELECT name,email,phone,cv from applicants";
$res = $this->db->query($sql);
$exceldata="";
foreach ($res->result_array() as $row){
$exceldata[] = $row;
}
$this->excel->getActiveSheet()->fromArray($exceldata, null, 'A3');
$this->excel->getActiveSheet()->getStyle('A3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('B3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('C3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('D3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER)
我希望单元格显示链接指向文件的值。 期望的细胞输出:
离。 href="http://examle.com/uploads/cv/ '. cell_value .'">cellvalue
答案 0 :(得分:1)
将单元格设置为超链接,如PHPExcel Documentation中所述,并在示例中显示,如05featuredemo
{{1}}
答案 1 :(得分:0)
查看PHPExcel包中的feature demo,有一个如何向单元格添加链接的示例。
这是一些模拟代码:
$yourcell = "A3";
$objPHPExcel->getActiveSheet()->setCellValue($yourcell, 'www.example.net');
$objPHPExcel->getActiveSheet()->getCell($yourcell)->getHyperlink()->setUrl('http://www.example.net');
$objPHPExcel->getActiveSheet()->getCell($yourcell)->getHyperlink()->setTooltip('Navigate to website');