if (rtf != "") { //HttpContext.Current.Response.Buffer = true; //HttpContext.Current.Response.Clear(); //HttpContext.Current.Response.ContentType = "application/msword"; //HttpContext.Current.Response.AddHeader("content-disposition", "inline; filename=" + Common.MakeValidFileName(doc_name).Replace(" ","_").Replace("&","and") + ".doc"); //HttpContext.Current.Response.Write(rtf); //HttpContext.Current.Response.Flush(); //HttpContext.Current.Response.End(); string docName = isHighlight ? Regex.Replace(doc_name, "<[^>]*>", "", RegexOptions.IgnoreCase) : doc_name; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + Common.MakeValidFileName(docName).Replace(" ", "_").Replace(",", "_").Replace("&", "and") + ".doc"); HttpContext.Current.Response.AddHeader("Content-Length", rtf.Length.ToString()); HttpContext.Current.Response.ContentType = "application/octet-stream"; HttpContext.Current.Response.Write(rtf); HttpContext.Current.Response.Flush(); //HttpContext.Current.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); //to save a doc instead of displaying on screen //StreamWriter sw = new StreamWriter("d:\\V3Docs\\CareHome\\" + Common.MakeValidFileName(doc_ref + "__" + doc_name.Replace(" ", "_") + ".doc"), false); //sw.Write(rtf); //sw.Close(); } else { //Result.Text = "Converting failed!"; } } } catch (Exception e) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)