Beispiel #1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="rows">数据</param>
        /// <param name="fileName">文件名</param>
        public AgileCsvResult(DataTable rows, ControllerBase controller, string fileName = "Export")
            : base()
        {
            controller.HttpContext.Response.Headers.Add("content-disposition", "attachment; filename=" + fileName + ".csv");

            this.Content = AgileCsv.ToCsv(rows);

            this.ContentType = "text/csv";
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="rows">数据</param>
        /// <param name="fileName">文件名</param>
        public AgileCsvResult(DataTable rows, string fileName = "Export")
            : base()
        {
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".csv");

            this.Content = AgileCsv.ToCsv(rows);

            this.ContentType = "text/csv";

            this.ContentEncoding = Encoding.Default;
        }