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的基本内容就向你介绍到这里,希望对你了解和学习C#操作Word有所帮助。
【编辑推荐】