Response BinaryWrite does not allow the splitting column in export excel. It creates single column of entire data

36 Views Asked by At

When i try to export the Sitecore data into excel with multiple languages like Russian, Portuguese and so on i am facing data issue so i try to use Response.BinaryWrite option. All the language values are coming as expected but now i am facing unable to split the data into multiple columns.

`protected void StartResponse(string fileName)
        {
            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.csv", fileName));
            Response.Charset = "";
            Response.ContentType = "text/csv";
            Response.ContentEncoding = System.Text.Encoding.UTF32;
            Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());

        }

        protected void SetCookieAndResponse(string responseValue)
        {
            var downloadToken = txtDownloadToken.Value;
            var responseCookie = new HttpCookie("DownloadToken");
            responseCookie.Value = downloadToken;
            responseCookie.HttpOnly = false;
            responseCookie.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(responseCookie);
            Response.Output.Write(responseValue);
            Response.Flush();
            Response.End();
        }`

Is that possible, can we do split the columns based on the data which are comma separated with Response.BinaryWrite method.

0

There are 0 best solutions below