This is a migrated thread and some comments may be shown as answers.

Export To Excel Problem

0 Answers 48 Views
GridView
This is a migrated thread and some comments may be shown as answers.
park
Top achievements
Rank 1
park asked on 20 Dec 2012, 11:06 AM
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. (???)

Also
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>
        [ScriptableMember]
        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 + "');");
            HtmlPage.Document.DocumentElement.AppendChild(script);
        }
        #endregion

No answers yet. Maybe you can help?

Tags
GridView
Asked by
park
Top achievements
Rank 1
Share this question
or