Google API获取文档/电子表格的内容 [英] Google API to get the Content of Document/SpreadSheet
本文介绍了Google API获取文档/电子表格的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以通过使用
获取所有文档的列表我想要显示一个Google文档的内容到我自己的页面。
http://代码.google.com / apis / documents / docs / 2.0 / developers_guide_dotnet.html
DocumentsService service = new DocumentsService exampleCo-ExampleApp中-1);
service.setUserCredentials(jo@gmail.com,mypassword);
DocumentsListQuery query = new DocumentsListQuery();
DocumentsFeed feed = service.Query(query);
foreach(Feed.Entries中的DocumentEntry条目)
{
Console.WriteLine(entry.Title.Text);
}
如何显示我的页面中Document的内容?
解决方案
您可以通过以下代码获取内容。 $ b
string content = string.Empty;
string ACLS = string.Empty;
foreach(feed.Entries中的DocumentEntry条目)
{
if(entry.IsDocument)
{
var stream = client.Query(new Uri (entry.Content.Src.ToString()));
var reader = new StreamReader(stream);
content = reader.ReadToEnd();
}
}
I want to get Display the content of a Google Doc in to the My own page.
I can get the List of all Document By using
http://code.google.com/apis/documents/docs/2.0/developers_guide_dotnet.html
DocumentsService service = new DocumentsService("exampleCo-exampleApp-1");
service.setUserCredentials("jo@gmail.com", "mypassword");
DocumentsListQuery query = new DocumentsListQuery();
DocumentsFeed feed = service.Query(query);
foreach (DocumentEntry entry in feed.Entries)
{
Console.WriteLine(entry.Title.Text);
}
How can I display the content of Document in My page?
解决方案
You can get the Content by the below code.
string content = string.Empty;
string ACLS=string.Empty;
foreach (DocumentEntry entry in feed.Entries)
{
if (entry.IsDocument)
{
var stream = client.Query(new Uri(entry.Content.Src.ToString()));
var reader = new StreamReader(stream);
content = reader.ReadToEnd();
}
}
这篇关于Google API获取文档/电子表格的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文