C#操作Word表的實(shí)例淺析
作者:shenyunjun420
C#操作Word表的實(shí)例向你介紹了C#操作Word表的實(shí)際操作細(xì)節(jié),希望對(duì)你了解C#操作Word有所幫助。
C#操作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);
- object start = 0;
- object end = 0;
- Word.Range tableLocation = oDoc.Range(ref start, ref end);
- oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing);
C#操作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);
- object start = 0;
- object end = 0;
- Word.Range tableLocation = oDoc.Range(ref start, ref end);
- oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing);
- Word.Table newTable = oDoc.Tables[1];
- object beforeRow = newTable.Rows[1];
- newTable.Rows.Add(ref beforeRow);
C#操作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);
- object start = 0;
- object end = 0;
- Word.Range tableLocation = oDoc.Range(ref start, ref end);
C#操作Word的基本內(nèi)容就向你介紹到這里,希望對(duì)你了解和學(xué)習(xí)C#操作Word有所幫助。
【編輯推薦】
責(zé)任編輯:仲衡
來源:
博客園