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的基本内容就向你介绍到这里,希望对你了解和学习C#操作Word有所帮助。
【编辑推荐】
- C# 操作XML的全过程实例浅析
- C#操作xml文件实例详解
- C#操作符重载应用的一点体会
- C#操作符重载特点实例浅析
- C#操作Word书签实例浅析
版权声明:
作者:后浪云
链接:https://www.idc.net/help/405526/
文章版权归作者所有,未经允许请勿转载。
THE END