<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      c#寫word文檔基礎(chǔ)操作(自己控制樣式)

      下面一個函數(shù),建立一個Word 文檔,添加頁眉、頁腳,在內(nèi)容中兩個不同字體的Hello!!!  

      來自 <http://bbs.csdn.net/topics/340041961>

      public void myFunction()

      {

      Word.ApplicationClass oWordApp = new Word.ApplicationClass();

      //建立Word 對象,啟動word程序

      object missing = System.Reflection.Missing.Value;

      object oTemplate = System.Windows.Forms.Application.StartupPath+"\\mytemplate.dot";

      Word.Document oWordDoc = oWordApp.Documents.Add( ref oTemplate,ref missing,ref missing, ref missing);//新建word文檔

      oWordApp.Visible = true;//設(shè)置Word程序可見,如果為false 那么word 不可見

      //頁面設(shè)置

      oWordDoc.PageSetup.TopMargin = oWordApp.CentimetersToPoints(2.5f); //上

      oWordDoc.PageSetup.BottomMargin = oWordApp.CentimetersToPoints(2f);//下

      oWordDoc.PageSetup.LeftMargin=oWordApp.CentimetersToPoints(2.2f);//左

      oWordDoc.PageSetup.RightMargin=oWordApp.CentimetersToPoints(2.2f);//右

      //添加頁眉

      oWordDoc.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekCurrentPageHeader; //激活頁眉的編輯

      oWordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; //設(shè)置對齊方式

      string headtext1 ="Head Text";

      oWordApp.Selection.Font.Name ="華文新魏"; //設(shè)置字體

      oWordApp.Selection.Font.Size =10.5f;

      oWordApp.Selection.Font.UnderlineColor = Word.WdColor.wdColorAutomatic;

      oWordApp.Selection.Font.Underline = Word.WdUnderline.wdUnderlineSingle; //添加下劃線

      oWordApp.Selection.TypeText(headtext1);

      oWordApp.Selection.Font.Underline = Word.WdUnderline.wdUnderlineNone;

      //添加頁腳

      string foottext1 ="Foot Text";

      oWordDoc.ActiveWindow.ActivePane.View.SeekView =Word.WdSeekView.wdSeekCurrentPageFooter; //激活頁腳的編輯

      oWordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;

      oWordApp.Selection.Font.Name ="仿宋_GB2312";

      oWordApp.Selection.Font.Size =8;

      oWordApp.Selection.TypeText(foottext1);

      //添加正文

      oWordDoc.ActiveWindow.ActivePane.View.SeekView =Word.WdSeekView.wdSeekMainDocument;//激活頁面內(nèi)容的編輯

      oWordApp.Selection.Font.Name ="宋體";

      oWordApp.Selection.Font.Size =10.5f;

      oWordApp.Selection.Font.Scaling = 200;

      oWordApp.Selection.TypeText("Hello!!!");

      oWordApp.Selection.TypeParagraph();//另起一段

      oWordApp.Selection.Font.Name ="黑體";

      oWordApp.Selection.Font.Size =10.5f;

      oWordApp.Selection.Font.Scaling = 100;

      oWordApp.Selection.TypeText("Hello!!!");

      oWordApp.Selection.TypeParagraph();//另起一段

      string strfilename = System.Windows.Forms.Application.StartupPath+"\\myfirst.doc";

      object filename = strfilename ;

      //保存文檔為word2000格式

      oWordDoc.SaveAs2000(ref filename,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing);

      //保存文檔為word2003格式

      //oWordDoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing,

      // ref missing, ref missing, ref missing, ref missing, ref missing,

      // ref missing, ref missing, ref missing, ref missing, ref missing,

      // ref missing) ;

      //以下關(guān)閉Word程序

      object nochanges = Word.WdSaveOptions.wdDoNotSaveChanges;

      if(oWordApp.Documents!= null)

      {

      IEnumerator ie = oWordApp.Documents.GetEnumerator();

      while( ie.MoveNext())

      {

      Word.Document closedoc = (Word.Document)ie.Current;

      closedoc.Close(ref nochanges,ref missing,ref missing);

      }

      }

      oWordApp.Quit(ref nochanges, ref missing, ref missing);

      }

      posted @ 2016-12-21 11:09  愛笑的3  閱讀(2704)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 亚洲中文字幕在线二页| 东京热加勒比无码少妇| 亚洲国产综合一区二区精品| 国产黄色一区二区三区四区| 一区二区传媒有限公司| 观塘区| 日本道不卡一二三区视频| 国产成人精品性色av麻豆| 国产精品久久久久久影视| 国产中文字幕精品在线| 亚洲中文字幕无码一久久区| 成人无码视频97免费| 襄城县| 色五月丁香五月综合五月4438| 亚洲一区成人av在线| 欧美综合自拍亚洲综合图| 国产台湾黄色av一区二区| 免费AV片在线观看网址| 熟女人妻aⅴ一区二区三区电影| 午夜AAAAA级岛国福利在线| 一区二区三区精品自拍视频 | 龙里县| 激情啪啪啪一区二区三区| 高清破外女出血AV毛片| 欧美日韩国产码高清| 亚洲综合色区另类av| 日本视频一区二区三区1| 亚洲AV无码破坏版在线观看| 亚洲丶国产丶欧美一区二区三区 | 亲子乱aⅴ一区二区三区| 在国产线视频A在线视频| 欧美乱妇高清无乱码免费| 一区二区三区四区国产综合| 国产成人av免费网址| 免费国产高清在线精品一区| 久久精品国产一区二区三区 | 日本一道一区二区视频| 汕尾市| 国产精品天堂蜜av在线播放| 四虎成人精品永久网站| 波多野结衣网站|