就是这样一个简单的问题,我现在还没有搞定,
只是可以导出word,但是不能实现html转换成word编码,导出来之后乱得一塌糊涂。全部都是标签。
大家有什么办法么?
商量一下。
谢谢了,很急。后天就要交的,救命啊!

解决方案 »

  1.   

    string content1="";
    conn=connc.getconn();
    string sql="select * from news where id=969";
    SqlCommand cmd=new SqlCommand(sql,conn);
    SqlDataReader readnews=cmd.ExecuteReader();
    if (readnews.Read()==true)
    {
    content1=readnews.GetString(2);
    }
    readnews.Close();
     
    object missing = System.Reflection.Missing.Value;
    object fileName = "normal.dot";
    object newTemplate = false;
    object docType = 0;
    object isVisible = true;
    Word.Document aDoc = WordApp.Documents.Add(ref fileName, ref newTemplate, ref docType, ref isVisible);
    WordApp.Visible = true;
    aDoc.Activate();
    WordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
    WordApp.Selection.Font.Bold = (int)Word.WdConstants.wdToggle;
    WordApp.Selection.TypeText(content1);这样导出的!?
      

  2.   

    string s = "....";
    s = System.Text.RegularExpressions.Regex.Replace(s, @"<[^>]+>","");