导出Word时提示 Word无法启动转换器 mswrd632.wpc

导出Word时提示 Word无法启动转换器 mswrd632.wpc_第1张图片

如图  而且word里有html 代码 解决方法:  加上

HttpContext.Current.Response.Write("<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns:m='http://schemas.microsoft.com/office/2004/12/omml' xmlns='http://www.w3.org/TR/REC-html40'><head></head><body lang=ZH-CN>" + sw.ToString());

加上就ok了

导出Word时提示 Word无法启动转换器 mswrd632.wpc_第2张图片

 

 public static void CreateDoc(string filename, Article article)
       {
           HttpContext.Current.Response.Clear();
           HttpContext.Current.Response.Buffer = true;
           HttpContext.Current.Response.Charset = "GB2312";
           HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpContext.Current.Server.UrlEncode(filename));
           HttpContext.Current.Response.ContentType = "application/ms-word";
           StringWriter sw = new StringWriter();
           HtmlTextWriter hw = new HtmlTextWriter(sw);

           if (article.ArticleTypeId == Publishing.ArticleType.NormalArticle)
           {
               NormalArticle normal = article as NormalArticle;
               hw.Write(article.Name + "<br />" + normal.Content);

           }

          // HttpContext.Current.Response.Write("<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns:m='http://schemas.microsoft.com/office/2004/12/omml' xmlns='http://www.w3.org/TR/REC-html40'><head></head><body lang=ZH-CN>" + sw.ToString());

           HttpContext.Current.Response.Write(sw.ToString());
           HttpContext.Current.Response.End();
       }

 

你可能感兴趣的:(导出Word时提示 Word无法启动转换器 mswrd632.wpc)