C#.NET关于处理WORD文档的一般方法

2009年4月25日星期六

C#.NET关于处理WORD文档的一般方法


 
 
最近在写

关于C#.NET处理WORD文档的一般方法


关于C#.NET处理WORD文档的一般方

 


 


最近在写一个关于处理WORD文档的工具,对WORD文档自动化处理有了一点了解。



 
 
最近在写

 



在自己的程序里,使用了这样一个模板,对WORD文档进行处理。不过,它只用于处理WORD文档的第一步,即打开WORD文档。要想对WORD文档进行更多的操作,还是需要自己下一番功夫的。


 


一个关于处理WORD文档的工具,对WOR

 


源代码:


 


D文档自动化处理有了一点了解。
&nbs

private void handelFile()  //处理文件



   
Word.ApplicationClass MyWord = null;p;

在自己的程序里,使用了这样一个模


    Object Nothing =
System.Reflection.Missing.Value;

    Word.Document MyDoc =
null;

    Word.Document dotDoc =
null;p;

在自己的程序里,使用了这样一个模




    try

    {p;

在自己的程序里,使用了这样一个模


     
  MyWord = new
Word.ApplicationClass(); 



           
try关于C#.NET处理WORD文档的一般方

     
     


               
//源文件名

     
     
    object source = "";
 
 
最近在写


     
     
    //打开指定文件

     
     
    MyDoc =
MyWord.Documents.Open(ref source, ref Nothing, ref Nothing, ref
Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref
Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref
Nothing, ref Nothing, ref Nothing);

     
     
   关于C#.NET处理WORD文档的一般方

     
     
    //处理 



               
//目地文件名一个关于处理WORD文档的工具,对WOR

     
     
    object NewFileName =
"";

     
     
   
//将WordDoc文档对象的内容保存为DOC文档

     
     
    MyDoc.SaveAs(ref NewFileName,
ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing,
ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref
Nothing);关于C#.NET处理WORD文档的一般方

     
      }

     
      catch
(Exception Err)

     
     
一个关于处理WORD文档的工具,对WOR



           
}

     
     
finallyD文档自动化处理有了一点了解。
&nbs


     
      {

     
     
    //关闭WordDoc文档对象

     
     
    MyDoc.Close(ref Nothing, ref
Nothing, ref Nothing); 关于C#.NET处理WORD文档的一般方

           




D文档自动化处理有了一点了解。
&nbs


    }

    catch (Exception Err)

    {p;

在自己的程序里,使用了这样一个模


     
  MessageBox.Show(Err.Message, "提示",
MessageBoxButtons.OK, MessageBoxIcon.Information);

    }

    finallyp;

在自己的程序里,使用了这样一个模


   

       
//关闭WordApp组件对象

     
  MyWord.Quit(ref Nothing, ref Nothing, ref
Nothing);一个关于处理WORD文档的工具,对WOR

    }

}


关于C#.NET处理WORD文档的一般方

更多信息请参考MSDN。


 


0 评论:

发表评论