private void ExportToExcel(byte[] ba, ExportDetails details)
        {
            // common initialize
            ExportInit(ba, details);

            //set the response mime type for excel
            if (details.Filename.EndsWith(".xlsx"))
            {
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            }
            else
            {
                Response.ContentType = "application/vnd.ms-excel";
            }

            // now the data
            Response.BinaryWrite(ba);

            //all that's left is to output the html
            Response.End();
        }
 private void ExportToExcel(System.IO.StringWriter ms, ExportDetails details)
 {
     ExportToExcel(System.Text.Encoding.UTF8.GetBytes(ms.ToString()), details);
 }