Zend_Gdata:检索文本文档内容?
检索用于特定电子表格的电子表格内容并不难:
$key = 'txSLYk4BpIQaglM38cJbTNA'; // key for a specific spreadsheet
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($key);
$feed = $spreadSheetService->getWorksheetFeed($query);
$entries = $feed->entries[0]->getContentsAsRows();
var_dump($entries); // dumps the spreadsheet content
我可以对特定文本文档执行相同的操作吗? Zend_Gdata_Docs_Query 类没有 ->setDocumentKey($key) 或等效的...
/ Jonas
Retrieving spreadsheet content using for a specific spreadsheet isn't that hard:
$key = 'txSLYk4BpIQaglM38cJbTNA'; // key for a specific spreadsheet
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($key);
$feed = $spreadSheetService->getWorksheetFeed($query);
$entries = $feed->entries[0]->getContentsAsRows();
var_dump($entries); // dumps the spreadsheet content
Can I do the same for a specific text document?
The Zend_Gdata_Docs_Query class doesn't have a ->setDocumentKey($key) or equivalent...
/ Jonas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(注意:我自己没有使用过 ZF 的 GData API...这是基于浏览 API 的推测)
看起来您可以调用
Zend_Gdata_Docs::getDoc()
- 这将返回一个Zend_Gdata_Docs_DocumentListEntry
,它又公开一个getContent()
方法。所以:
看起来电子表格是这种更通用的检索 Google 文档内容的方式的更专业的形式。
(note: I haven't worked with ZF's GData API myself... this is speculative, based on browsing through the API)
It looks like you can call
Zend_Gdata_Docs::getDoc()
- this will return aZend_Gdata_Docs_DocumentListEntry
which in turn exposes agetContent()
method.So:
It looks like the spreadsheet is a more specialised form of this more generic way of retrieving Google Docs content.