您现在的位置:首页 > 学术研究 > 读书笔记 > C#操作word文档[转]
C#操作word文档[转]
[发布时间:2015-03-03  阅读次数: 13777]

21

     try

22

     {

23

      doc = app.documents.open(ref filename, ref missing, ref readonly,

24

       ref missing, ref missing, ref missing, ref missing, ref missing,

25

       ref missing, ref missing, ref missing, ref isvisible, ref missing,

26

       ref missing, ref missing, ref missing);

27

28

      doc.activewindow.selection.wholestory();

29

      doc.activewindow.selection.copy(); 

30

      //从剪切板获取数据

31

      idataobject data=clipboard.getdataobject();

32

      this.richtextbox1.text=data.getdata(dataformats.text).tostring();

33

      

34

     }

35

     finally

36

     {

37

      if (doc != null)

38

      {

39

       doc.close(ref missing, ref missing, ref missing);

40

       doc = null;

41

      }

42

43

      if (app != null)

44

      {

45

       app.quit(ref missing, ref missing, ref missing);

46

       app = null;

47

      }

48

     }

49

50

    }

51

52

   }

首页上一页下一页尾页当前为13/13页