本文介绍了如何使用Zend GData创建一个空的电子表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Zends GData Library创建一个新的空电子表格?
How to create a new, empty spreadsheet using Zends GData Library?
推荐答案
根据 Google文档列表API ,以创建一个新的空电子表格:请按照中的说明进行操作仅元数据.这样做时,请使用 http://schemas.google.com/docs/2007#spreadsheet 的类别术语.
According to the Google Documents List API, to create a new, empty spreadsheet: follow the instructions in Creating a new document or file with metadata only. When doing so, use a category term of http://schemas.google.com/docs/2007#spreadsheet.
使用Zend GData库,它可能看起来像这样:
With Zend GData library, it may look like this:
// Load Zend library
require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Docs');
// Authentication
$client = Zend_Gdata_ClientLogin::getHttpClient('[email protected]', 'sunshine-', Zend_Gdata_Docs::AUTH_SERVICE_NAME);
// Get interface to Documents List API
$docs = new Zend_Gdata_Docs($client);
// Create new document
$data = new Zend_Gdata_Docs_DocumentListEntry();
$data->setCategory(
array(new Zend_Gdata_App_Extension_Category(
"http://schemas.google.com/docs/2007#spreadsheet",
"http://schemas.google.com/g/2005#kind"
)));
$data->setTitle(new Zend_Gdata_App_Extension_Title("My brand new spreadsheet", null));
// Add document to your list
$doc = $docs->insertDocument($data, Zend_Gdata_Docs::DOCUMENTS_LIST_FEED_URI);
// Display document ID
print($doc->getId());
这篇关于如何使用Zend GData创建一个空的电子表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!