美图齐众专注资阳网站设计 资阳网站制作 资阳网站建设
资阳网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

C#操作Word表的实例浅析

C#操作Word之添加新表

成都做网站、网站建设、外贸营销网站建设的关注点不是能为您做些什么网站,而是怎么做网站,有没有做好网站,给创新互联公司一个展示的机会来证明自己,这并不会花费您太多时间,或许会给您带来新的灵感和惊喜。面向用户友好,注重用户体验,一切以用户为中心。

 
 
 
  1. object oMissing = System.Reflection.Missing.Value;  
  2.  
  3. Word._Application oWord;  
  4.  
  5. Word._Document oDoc;  
  6.  
  7. oWord = new Word.Application();  
  8.  
  9. oWord.Visible = true;  
  10.  
  11. oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,  
  12.     ref oMissing, ref oMissing);  
  13.  
  14. object start = 0;  
  15.  
  16. object end = 0;  
  17.  
  18. Word.Range tableLocation = oDoc.Range(ref start, ref end);  
  19.  
  20. oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing); 

C#操作Word之表插入行

 
 
 
  1. object oMissing = System.Reflection.Missing.Value;  
  2.  
  3. Word._Application oWord;  
  4.  
  5. Word._Document oDoc;  
  6.  
  7. oWord = new Word.Application();  
  8.  
  9. oWord.Visible = true;  
  10.  
  11. oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,  
  12.     ref oMissing, ref oMissing);  
  13.  
  14. object start = 0;  
  15.  
  16. object end = 0;  
  17.  
  18. Word.Range tableLocation = oDoc.Range(ref start, ref end);  
  19.  
  20. oDoc.Tables.Add(tableLocation, 3, 4, ref oMissing, ref oMissing);  
  21.  
  22. Word.Table newTable = oDoc.Tables[1];  
  23.  
  24. object beforeRow = newTable.Rows[1];  
  25.  
  26. newTable.Rows.Add(ref beforeRow); 

C#操作Word之单元格合并

 
 
 
  1. object oMissing = System.Reflection.Missing.Value;  
  2.  
  3. Word._Application oWord;  
  4.  
  5. Word._Document oDoc;  
  6.  
  7. oWord = new Word.Application();  
  8.  
  9. oWord.Visible = true;  
  10.  
  11. oDoc = oWord.Documents.Add  
  12. (ref oMissing, ref oMissing,  
  13. ref oMissing, ref oMissing);  
  14.  
  15. object start = 0;  
  16.  
  17. object end = 0;  
  18.  
  19. Word.Range tableLocation = oDoc.Range(ref start, ref end); 

C#操作Word的基本内容就向你介绍到这里,希望对你了解和学习C#操作Word有所帮助。

【编辑推荐】

  1. C# 操作XML的全过程实例浅析
  2. C#操作xml文件实例详解
  3. C#操作符重载应用的一点体会
  4. C#操作符重载特点实例浅析
  5. C#操作Word书签实例浅析

本文题目:C#操作Word表的实例浅析
文章URL:http://www.zsjierui.cn/article/djojphp.html

其他资讯