【问题标题】:Google API to get the Content of Document/SpreadSheetGoogle API 获取文档/电子表格的内容
【发布时间】:2011-06-20 06:39:03
【问题描述】:

我想在我自己的页面中显示 Google Doc 的内容。

我可以通过使用获取所有文档的列表

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);
}

如何在我的页面中显示 Document 的内容?

【问题讨论】:

  • 如何在我的应用程序中为“DocumentsService”添加 dll 或任何内容??

标签: c# asp.net google-api


【解决方案1】:

您可以通过以下代码获取内容。

 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();
    }
    }

【讨论】:

  • 如何在我的应用程序中为“DocumentsService”添加 dll 或任何内容??
【解决方案2】:

除非 DocumentEntry 类中有一个属性可以返回文档的内容,否则我认为没有办法。他们似乎没有通过 API 公开这一点。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-05
    • 1970-01-01
    • 2015-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多