Below is the code. What are the changes we need to do.
HttpContext context = HttpContext.Current;
    context.Response.Clear();
    context.Response.AppendHeader("content-disposition", "attachment;filename=" + strFileName + ".docx");
    context.Response.Charset = "";
    context.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
    var stringWriter = new StringWriter();
    stringWriter.Write(strContent);
    var htmlWriter = new HtmlTextWriter(stringWriter);
    System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(stringWriter);
    HttpContext.Current.Response.Write(oHtmlTextWriter);
    context.Response.Write(stringWriter.ToString());
    context.Response.End();