PhpExcel:删除 sheet 中的所有格式
PhpExcel: remove all formatting from sheet
我正在使用库 PhpExcel 从 Excel.
导入数据
我想从电子表格中删除所有格式,以便我可以使用 RangeToArray 函数准备值。
或
我想读取范围值,但 rangeToArray 似乎考虑了格式。
我该怎么办?
非常感谢,
如果您查看 rangeToArray()
方法的参数,您会发现它默认
考虑格式
/**
* Create array from a range of cells
*
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
* True - Return rows and columns indexed by their actual row and column IDs
* @return array
*/
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
但是您可以简单地通过将布尔值 false
作为第四个参数传递来更改该行为
我正在使用库 PhpExcel 从 Excel.
导入数据我想从电子表格中删除所有格式,以便我可以使用 RangeToArray 函数准备值。
或
我想读取范围值,但 rangeToArray 似乎考虑了格式。
我该怎么办?
非常感谢,
如果您查看 rangeToArray()
方法的参数,您会发现它默认
/**
* Create array from a range of cells
*
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
* True - Return rows and columns indexed by their actual row and column IDs
* @return array
*/
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
但是您可以简单地通过将布尔值 false
作为第四个参数传递来更改该行为