假设我在工作表中有一个单元格,其值为“最后一个数据单元格” 这是使用Zend GData获取该单元格索引(即A5)的正确方法吗?
$query = new Zend_Gdata_Spreadsheets_CellQuery();
$query->setSpreadsheetKey($this->_spreadsheetKey);
$query->setWorksheetId($worksheet);
$cellFeed = $this->_spreadsheetService->getCellFeed($query);
foreach($cellFeed as $cellEntry) {
$row = $cellEntry->getCell()->getRow();
$col = $cellEntry->getCell()->getColumn();
$val = $cellEntry->getCell()->getText();
if ($val == 'last data cell'){ $index = array($row, $col); }
//echo "$row, $col = $val\n";
}
return $index;
我想稍后使用$ index值作为边界来定义范围,例如:
$range = (string)$index[0]+1 + $index[1].":F20";
$contentAsCells = $worksheet->getContentsAsCells($range);
但索引值是数字。我如何将其转换为“A1”格式? 感谢
答案 0 :(得分:0)
您可以像这样获取小区ID:
$cellId = $row . $col; //vars from your code above.
echo $cellId;
如果$ col为'A'且$ row为1,则输出
A1