[英]PhpExcel: Passing parameters then set cell value dynamically
From main.php 从main.php
$id = $_GET['id'];
<a href="second.php?id=".$id."&name=apple">Excel</a>
How to get the parameters from the url, id and name to Excel and set the cell value dynamically? 如何从url,id和name中获取参数到Excel并动态设置单元格值?
Given that there is 2 ids. 鉴于有2个ID。
Assume that second.php has all the PhpExcel codes. 假设second.php具有所有的PhpExcel代码。
Try this: 尝试这个:
$id = $_GET['id'];
$sheet = $objPHPExcel->getActiveSheet(); //or whatever sheet you like
$index = $sheet->getHighestDataRow();
$sheet->setCellValueByColumnAndRow(0, $index + 1, $id);
(not tested) (未测试)
Please refer to PHPExcel how to set cell value dynamically for a similar question. 有关类似问题,请参考PHPExcel如何动态设置单元格值 。
I hope it helps! 希望对您有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.