我正在写一个PHP脚本生成Excel通过使用PHP的Excel报表Excel中的拖曳。我想这样做是允许用户指定细胞的contants可以“拖动”。我的意思是要利用或模拟Excel中的该功能,可以让用户选择一个或多个小区,为了产生相邻单元格的内容拖动的内容。我无法找到关于此的任何信息。我是否需要在脚本中生成单元格的内容,或者是否存在PHP excel的一些鬼鬼祟祟的功能,可以为我做到这一点?我会假设前者,但我对PHPExcel很新,所以想在潜入之前确定。PhpExcel:如何模拟单元格内容
2
A
回答
4
PHPExcel没有“偷偷摸摸”的功能,您必须为每个单元格设置内容,但有一对夫妇的方法,可以帮助在一个单一的通话设置几个单元格的值。
如果你谈论的是直线数据内容,你可以指定一个起始细胞,并通过数值数组到工作表的fromArray()方法:
* Fill worksheet from values in array
*
* @param array $source Source array
* @param mixed $nullValue Value in source array that stands for blank
* cell
* @param string $startCell Insert array starting from this cell
* address as the top left coordinate
* @param boolean $strictNullComparison Apply strict comparison when testing for null
* values in the array
* @throws Exception
* @return PHPExcel_Worksheet
public function fromArray($source = null,
$nullValue = null,
$startCell = 'A1',
$strictNullComparison = false
)
如果您需要在一系列的操作公式细胞,例如= $ A1 + $ B1 + $ C $ 1为一组行,这样$ A1和$ B1成为第二行的$ A2和$ B2,第三行的$ A3和$ B3等,那么ReferenceHelper的updateFormulaReferences()方法可能有用:
* Update references within formulas
*
* @param string $pFormula Formula to update
* @param int $pBefore Insert before this one
* @param int $pNumCols Number of columns to insert
* @param int $pNumRows Number of rows to insert
* @return string Updated formula
* @throws Exception
public function updateFormulaReferences($pFormula = '',
$pBefore = 'A1',
$pNumCols = 0,
$pNumRows = 0,
$sheetName = ''
)
相关问题
- 1. phpexcel如何获取单元格格式
- 2. phpexcel单元格值
- 3. PHPExcel:如何从单元格中读取内容来自其他表格中的单元格的值
- 4. 如何在phpExcel中拆分单元格
- 5. 表格单元格内容
- 6. PHPexcel单元格缓存
- 7. PHPExcel单元格类型
- 8. Phpexcel填充空单元格
- 9. 如何编辑UITableView单元格内容
- 10. phpexcel中的单元格格式
- 11. PHPExcel采用空单元格格式
- 12. PHPExcel读取单元格格式
- 13. 如何使用单元格ID访问HTML表格中单元格的内容?
- 14. 如果功能的单元格内容
- 15. PHPExcel如何使用setFormula1将表单列链接到单元格()
- 16. 单元格内容出现在模拟器和iPhone上,但不在iPad上
- 17. 更改单元格的内容,具体取决于单元格中的内容
- 18. HTML Javascript表格单元格的内容
- 19. 公式内部的单元格内容
- 20. UITableViewCell单击编辑单元格内容
- 21. 如何在输入单元格时加密excel单元格内容?
- 22. 如何重复选定的单元格或单元格的内容?
- 23. PHPExcel清除单元格注释
- 24. PHPExcel在列和单元格中打印
- 25. PHPExcel - 从单元格读取时间值
- 26. 禁用PHPExcel中的几个单元格
- 27. PHPExcel单元格中的多个图像
- 28. 无效的单元格坐标phpExcel
- 29. codeplex phpexcel仅选择数据单元格
- 30. PHPExcel:读取单元格时出错
你怎么想实现这个?你想允许用户这样做在一个HTML表?你想在哪里发生“拖动”,以及用户如何与它进行交互? – DaveRandom 2012-02-08 10:40:43