如题:  例如:Word文档里有一串字符:@姓名@,如何返这个 自动转换成 数据表里的一个值

解决方案 »

  1.   

    http://hi.baidu.com/yzy666/blog/item/b1501f25c7f80e6335a80f1f.html
    这里有
      

  2.   

    http://www.codeproject.com/KB/office/searchfile.aspx可以看看codeproject上面关于word开发的一些示例程序和说明,这里的文章不单单有代码,更重要的是有说明文档,希望对你有帮助。
      

  3.   

    ///<summary>
            /// 在word 中查找一个字符串直接替换所需要的文本
            /// </summary>
            /// <param name="strOldText">原文本</param>
            /// <param name="strNewText">新文本</param>
            /// <returns></returns>
            public bool Replace(string strOldText,string strNewText)
            {
                this.oDoc.Content.Find.Text = strOldText ;
                object FindText,  ReplaceWith, Replace ;// 
                object MissingValue = Type.Missing; 
                FindText = strOldText ;//要查找的文本
                ReplaceWith = strNewText ;//替换文本
                   Replace = Word.WdReplace.wdReplaceAll ;/**//*wdReplaceAll - 替换找到的所有项。
                                                          * wdReplaceNone - 不替换找到的任何项。
                                                        * wdReplaceOne - 替换找到的第一项。
                                                        * */
                this.oDoc.Content.Find.ClearFormatting();//移除Find的搜索文本和段落格式设置
                if (this.oDoc.Content.Find.Execute(
                    ref FindText,ref MissingValue,
                    ref MissingValue,ref MissingValue,
                    ref MissingValue,ref MissingValue,
                    ref MissingValue,ref MissingValue,ref MissingValue,
                    ref ReplaceWith,ref Replace,
                    ref MissingValue,ref MissingValue,
                    ref MissingValue,ref MissingValue))
                {
                    return true ;
                }
                return false ;
                
            }
    说明:其中oDoc是一个word文档的Document对象.
      

  4.   

       有没有操作office2007的类?
      

  5.   

    楼上所有的方式,好象都不对都是采用 调用服务端方式的,这种方式好象不是太安全
    应该是采用调用的方式,不知道各位有何见解另外,有没有第三方的控件可以实现1、在网页上通过控件打开服务端WORD文件
    2、自动用控件进行查找替换
    3、保存
    4、关闭不知道有没有这种控件,看了 openOffice 感觉太庞大了
    不知道 Office Framer 怎么样
    有没有人有这方面的开发经验
      

  6.   

    關鍵問題在於你的word檔是怎么打開的