导出的excel在iphone中显示未识别的字符

时间:2016-06-02 07:49:36

标签: ios iphone excel model-view-controller

我有这个转换数据的代码

            using (XLWorkbook wb = new XLWorkbook())
            {
                wb.Worksheets.Add(dt);



                wb.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;

                wb.Style.Font.Bold = true;
                //string strpath = Server.MapPath("~/SavedFolder/hello.xlsx");

                //wb.SaveAs(strpath);
                HttpContext.Response.Clear();
                HttpContext.Response.Buffer = true;
                HttpContext.Response.Charset = "";
                HttpContext.Response.ContentType = "application/vnd.ms-excel";
                //HttpContext.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename= ResultReport.xls");


                using (MemoryStream MyMemoryStream = new MemoryStream())
                {
                    wb.SaveAs(MyMemoryStream);
                    MyMemoryStream.WriteTo(HttpContext.Response.OutputStream);
                    HttpContext.Response.Flush();
                    HttpContext.Response.End();

                }

在PC上工作正常但在iphone或ipad上显示错误无法读取。

那么我做了什么,将内容类型转换为CSV格式, 然后excel正在打开,但显示的数据并不是英语的乱码。

我尝试使用iphone的免费应用程序打开excel打开文档相同的结果  可以有人帮忙。

0 个答案:

没有答案