【问题标题】:Zend Gdata Spreadsheet not feeding cells if empty at the beginning of the sheet如果表格开头为空,Zend Gdata 电子表格不提供单元格
【发布时间】:2014-06-18 23:59:55
【问题描述】:

我在将我的 Google Drive 电子表格与我的 php 页面链接时遇到了一点问题。 我正在使用 Zend Gdata 库。 这是我正在使用的代码:

$query = new Zend_Gdata_Spreadsheets_CellQuery();
$query->setSpreadsheetKey($key);
$cellFeed = $spreadSheetService->getCellFeed($query);
   $foglio=array();
foreach($cellFeed as $cellEntry) {
  $row = $cellEntry->cell->getRow();
  $col = $cellEntry->cell->getColumn();
  $val = $cellEntry->cell->getText();
  $foglio[$row][$col]=$val;
}

这一切都很好,但有一件事..当代码遇到没有值的行时...它只是跳过提供这些值..例如: 在这里,我的值很长,直到文档末尾。超过 45-50 列,程序只是在 getCellFeed 中跳过它们。当我尝试访问它们时给我错误

Image 01

如果我像下图一样在开头附近的单元格中写了一些东西,相反,该程序可以完美运行......但我不想为了解决问题而用随机数或字符破坏我的电子表格,建议?

Image 02

【问题讨论】:

  • 与应用程序脚本无关。删除标签

标签: php excel zend-framework gdata


【解决方案1】:

这是设计使然。单元格提要不返回数组数组格式的数据,而是使用行提要(但在第一个空白行停止) 您需要对数组进行后处理以填充缺失的行和列,或者在使用数组时处理缺失条目的情况。

【讨论】:

    猜你喜欢
    • 2011-11-05
    • 1970-01-01
    • 2013-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-13
    • 2011-06-22
    相关资源
    最近更新 更多