C#操作Word之創(chuàng)建、打開Word
作者:shenyunjun420
C#操作Word之創(chuàng)建、打開Word是如何實現(xiàn)的呢?C#操作Word之創(chuàng)建、打開Word具體的操作是什么呢?那么本文就向你介紹這方面的內容。
C#操作Word之創(chuàng)建、打開Word前提:
導入COM庫:Microsoft word 11.0 Object Library.
引用里面就增加了:
C#操作Word之創(chuàng)建、打開Word之創(chuàng)建新Word
- object oMissing = System.Reflection.Missing.Value;
- Word._Application oWord;
- Word._Document oDoc;
- oWord = new Word.Application();
- oWord.Visible = true;
- oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
- ref oMissing, ref oMissing);
C#操作Word之創(chuàng)建、打開Word之打開文檔:
- object oMissing = System.Reflection.Missing.Value;
- Word._Application oWord;
- Word._Document oDoc;
- oWord = new Word.Application();
- oWord.Visible = true;
- object fileName = @"E:CCCXCXXTestDoc.doc";
- oDoc = oWord.Documents.Open(ref fileName,
- ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
- ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
- ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
C#操作Word之創(chuàng)建、打開Word的操作就向你介紹到這里,希望對你了解和學習C#操作Word之創(chuàng)建、打開Word有所幫助。
【編輯推薦】
責任編輯:仲衡
來源:
博客園