2016-08-02 1 views
0

웹 페이지의 콘텐츠를 스프레드 시트로 다운로드하는 방법은 무엇입니까? 아래는 다운로드 할 수있는 코드입니다. 웹 페이지에있는 다른 콘텐츠는 다운로드 할 수 없습니다. 전체 웹 페이지의 데이터전체 웹 페이지 데이터를 스프레드 시트로 다운로드하려면 어떻게해야합니까?

protected void BtnSave_Click(object sender, EventArgs e) 
       { 
        Response.ClearContent(); 
        Response.AddHeader("content-disposition", "attachment; filename=Details.ods"); 
        Response.ContentType = "vnd.oasis.opendocument.text"; 
        System.IO.StringWriter sw = new System.IO.StringWriter(); 
        HtmlTextWriter htw = new HtmlTextWriter(sw); 
        GridView1.RenderControl(htw); 
        Response.Write(sw.ToString()); 
        Response.End(); 


       } 
       public override void VerifyRenderingInServerForm(Control control) 
       { 

       } 
      } 
+0

무엇 "텍스트"의 목적은 무엇입니까? 당신은 선언하지만 그것을 사용하지 마십시오. – Fandango68

+0

ODS가 "Excel"의 OpenOffice라고 가정합니까? – Fandango68

+0

마지막으로 Session [] 변수는 ASP : Label 컨트롤을 채우기 위해 사용 된 것 같습니다. 메시지를 ODS 파일에 저장 하시겠습니까? – Fandango68

답변

관련 문제