国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

C#操作Word生成目錄

2019-11-17 03:03:41
字體:
來源:轉載
供稿:網友
C#操作Word生成目錄C#代碼收藏代碼
  1. OperateWordow=newOperateWord();
  2. Microsoft.Office.Interop.Word.applicationClassss=ow.WordApplication;
  3. AddContent(refss);
  4. voidAddContent(refMicrosoft.Office.Interop.Word.ApplicationClassapp)
  5. {
  6. ObjectoMissing=System.Reflection.Missing.Value;
  7. ObjectoTrue=true;
  8. ObjectoFalse=false;
  9. ObjectoUpperHeadingLevel="1";
  10. ObjectoLowerHeadingLevel="3";
  11. ObjectoTOCTableID="TableOfContents";
  12. app.Selection.Start=0;
  13. app.Selection.End=0;//將光標移動到文檔開始位置
  14. objectbeginLevel=2;//目錄開始深度
  15. objectendLevel=2;//目錄結束深度
  16. objectrightAlignPageNumber=true;//指定頁碼右對其
  17. /*
  18. *Range
  19. *UserHeadingStyles使用heading風格
  20. *UpperHeadingLevel增加heading級別
  21. *LowerHeadingLevel減小heading級別
  22. *UserFields使用fields
  23. *Tableidtableid
  24. *RightAlignPageNumbers右對齊頁數
  25. *IncludePageNumbers包含頁數
  26. *Addedstyles添加風格
  27. *UserHyperlinks使用超鏈接
  28. *HidePageNumbersInweb隱藏頁數
  29. *USEOutLineLevels使用提綱級別
  30. *TableOfContents內容表
  31. */
  32. app.Application.ActiveDocument.TablesOfContents.Add(app.Selection.Range,refoTrue,refoUpperHeadingLevel,
  33. refoLowerHeadingLevel,refoMissing,refoTOCTableID,refoTrue,
  34. refoTrue,refoMissing,refoTrue,refoTrue,refoTrue);//添加目錄
  35. //寫入目錄
  36. }

參考1:

C#代碼Flashvars" value="clipboard=PRivate%20void%20button1_Click(object%20sender%2C%20EventArgs%20e)%0A%20%20%20%20%20%20%20%20%7B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20Object%20oMissing%20%3D%20System.Reflection.Missing.Value%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Object%20oTrue%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Object%20oFalse%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20Microsoft.Office.Interop.Word.Application%20oWord%20%3D%20new%20Microsoft.Office.Interop.Word.Application()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Microsoft.Office.Interop.Word.Document%20doc%20%3D%20new%20Microsoft.Office.Interop.Word.Document()%3B%20%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20oWord.Visible%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20object%20fileName%20%3D%20this.textBox1.Text%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20doc%20%3D%20oWord.Documents.Open(ref%20fileName%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing%2C%20ref%20oMissing)%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%2F%2F---------------------------------------------------------------------------------------------------------------------%0A%20%20%20%20%20%20%20%20%20%20%20%20oWord.Selection.Paragraphs.OutlineLevel%20%3D%20WdOutlineLevel.wdOutlineLevel2%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20oWord.Selection.Paragraphs.OutlineLevel%20%3D%20WdOutlineLevel.wdOutlineLevel3%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20oWord.Selection.Paragraphs.OutlineLevel%20%3D%20WdOutlineLevel.wdOutlineLevelBodyText%3B%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20object%20x%20%3D%200%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Range%20myRange%20%3D%20doc.Range(ref%20x%2C%20ref%20x)%3B%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20Object%20oUpperHeadingLevel%20%3D%20%221%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20Object%20oLowerHeadingLevel%20%3D%20%223%22%3
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 和静县| 利津县| 原平市| 蒙城县| 齐河县| 松阳县| 涞水县| 怀化市| 尉犁县| 如东县| 五指山市| 蕲春县| 清涧县| 荣成市| 博罗县| 申扎县| 黄陵县| 安龙县| 古丈县| 仙桃市| 乌拉特前旗| 长阳| 通海县| 沈阳市| 姚安县| 福泉市| 宁武县| 东山县| 大新县| 黎平县| 邵东县| 汕头市| 道孚县| 开封市| 黄浦区| 会理县| 高清| 双江| 邯郸县| 衡水市| 辽阳县|