在Google Docs Viewer电子表格中渲染HTML

时间:2019-05-10 09:26:53

标签: c# google-sheets google-docs-api

我正在尝试在Google文档电子表格中呈现HTML。在Excel中本地查看时,文件显示完全正常。但是,当同一文件上传到驱动器上并被Google文档查看时,HTML标记将显示在电子表格中。试图找到用于呈现HTML的URI参数,但未找到任何参数。下面是将文件上传到C#驱动器中时的代码块。

    {
        GoogleConnect.ClientId = "<CLient ID>";
        GoogleConnect.ClientSecret = "<Client Secret>";
        GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0];
        GoogleConnect.API = EnumAPI.Drive;
        if (!string.IsNullOrEmpty(Request.QueryString["code"]))
        {
            string code = Request.QueryString["code"];
            string json = GoogleConnect.PostFile(code, (HttpPostedFile)Session["File"], Session["Description"].ToString());

            GoogleDriveFile file = (new JavaScriptSerializer()).Deserialize<GoogleDriveFile>(json);
            tblFileDetails.Visible = true;
            lblTitle.Text = file.Title;
            lblId.Text = file.Id;
            imgIcon.ImageUrl = file.IconLink;
            lblCreatedDate.Text = file.CreatedDate.ToString();
            lnkDownload.NavigateUrl = file.WebContentLink;
            if (!string.IsNullOrEmpty(file.ThumbnailLink))
            {
                rowThumbnail.Visible = true;
                imgThumbnail.ImageUrl = file.ThumbnailLink;
            }
        }
    }


I expect the Google Docs Spreadsheet show the HTML in a proper way and not the HTML markup. Thanks.

0 个答案:

没有答案