Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: exported file is getting opened on windows. but not getting opened on android.

$
0
0
i have exported excel file successfully but problem is that that exported excel file is not getting opened in android, whereas i have seen many applications that export files to excel and same files are getting opened on android, then why not my exported file?
//filled dt sucessfully
using (XLWorkbook wb = new XLWorkbook())
        {

            wb.Worksheets.Add(dt);


            Response.Buffer = true;

            using (MemoryStream MyMemoryStream = new MemoryStream())
            {

                wb.SaveAs(MyMemoryStream);

                //response starts

                Response.Cache.SetCacheability(HttpCacheability.Private);
                Response.CacheControl = "private";
                Response.Charset = System.Text.UTF8Encoding.UTF8.WebName;
                Response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
                Response.AppendHeader("Content-Length", MyMemoryStream.Length.ToString());
                Response.AppendHeader("Pragma", "cache");
                Response.AppendHeader("Expires", "60");
                Response.AppendHeader("Content-Disposition",
                "attachment; " +
                "filename=\"Reports.xlsx\"; " +
                "size=" + MyMemoryStream.Length.ToString() + "; " +
                "creation-date=" + DateTime.Now.ToString() + "; " +
                "modification-date=" + DateTime.Now.ToString() + "; " +
                "read-date=" + DateTime.Now.ToString());
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                MyMemoryStream.WriteTo(Response.OutputStream);
                Response.Flush();
                Response.End();
            }
        }
on android docs to go app says "length=0; index0" and polaris office 5 app says "this document can not be opened"..

Viewing all articles
Browse latest Browse all 1877

Trending Articles