Export To Excel Problem

1 posts, 0 answers
  1. park
    park avatar
    4 posts
    Member since:
    Mar 2008

    Posted 20 Dec 2012 Link to this post

    HI i have Problem that gridview export to excel
    i exported to excel and opened
    but Excel Data was broken. T.T
    I seems to be a problem with the encoding. (???)

    have a strange problem occurred.
    I have two of the same source were deployed on the server.
    One of the servers are fine but another serever not well like the attach picture
    Does not come out at random.
    Please help me.

    #region 엑셀 다운로드
            /// <summary>
            /// Excel Download
            /// </summary>
            public void ScriptExcelDown()
                string strContent = "";
                strExcelFileName = "ProgramExport" + DateTime.Now.Millisecond.ToString();     // 중복 방지를 위해 Millisecond 붙임.
                strExcelExt = "xls";
                strContent = "";// TumListGrid2.ToHtml(true);
                Uri uri = new Uri(HtmlPage.Document.DocumentUri, String.Format("/pwa/_layouts/Epm/Common/ExportHandler.aspx?excleName={0}&type={1}", strExcelFileName, strExcelExt));
                WebClient client = new WebClient();
                client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
                client.UploadStringAsync(uri, strContent);
            void client_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
                // 엑셀 파일 다운로드
                HtmlElement script = HtmlPage.Document.CreateElement("script");
                script.SetProperty("text", "ScriptExcelDown('/pwa/_layouts/Epm/UploadData/TmpExcel/" + strExcelFileName + "." + strExcelExt + "');");
Back to Top