I want to convert DataTable to byte array in WCF services. After returning value to presentation layer, I want to convert byte array to excel. That is to say; I want to do below at presentation layer that is user interface side (web site).
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
Response.OutputStream.Write(s, 0, s.Length);
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.Flush();
Response.Close();
I didnot do it. How can I convert datatable to byte array?