问题
suppose i have a cell in a worksheet that has a value of "last data cell" is this the correct way to get the index of this cell (i.e A5) using Zend GData ?
$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;
i want to use the $index value later as a boundaries to define a range, like this for example:
$range = (string)$index[0]+1 + $index[1].":F20";
$contentAsCells = $worksheet->getContentsAsCells($range);
but the index value is numeric. how do i convert it to the "A1" format ? thanks
回答1:
You can get the cell ID like this:
$cellId = $row . $col; //vars from your code above.
echo $cellId;
If $col is 'A' and $row is 1 this will output
A1
来源:https://stackoverflow.com/questions/11089041/using-zend-gdata-how-do-i-get-a-worksheet-cell-index-by-looking-for-its-value