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

首頁 > 語言 > JavaScript > 正文

幾個javascript操作word的參考代碼

2024-05-06 14:13:16
字體:
來源:轉載
供稿:網友
代碼如下:
/*
給幾個js寫word的參考:
this.Word.Selection.Font.Size = 16; //字體大小
this.Word.Selection.Font.Bold = true; //是否加粗
this.Word.Selection.ParagraphFormat.Alignment = 2; //0左對齊,1居中,2右對齊,數字只能0-9,慢慢試吧
this.Word.Selection.InsertRowsBelow(1); //下面加入一行
this.Word.Selection.MoveRight(1); //光標右移
this.Word.Selection.TypeText(string); //只能寫string
this.Word.Selection.MoveDown(); //光標下移
this.Word.Selection.EndKey(); //光標移動到末尾
this.Word.ActiveDocument.Sections(1).Headers(1).Range.InsertAfter(string); //寫頁眉,結尾處寫
this._LoadData = function () {
//替換函數,用于替換$strFld$類型的文本
 function replace( Range, strFld ) {
//[FindText], [MatchCase], [MatchWholeWord], [MatchWildcards], [MatchSoundsLike], [MatchAllWordForms], [Forward], [Wrap], [Format], [ReplaceWith], [Replace], [MatchKashida], [MatchDiacritics], [MatchAlefHamza], [MatchControl]
 Range.Find.Execute( "$"+strFld+"$", true, false, false, false, false, true, wdFindContinue, false, getElValue("l"+strFld) )
 }
//初始化Word控件
 this._InitWord = function ()
 {
 try{
 this.Word = new ActiveXObject("Word.Application");
 this.Word.visible = true;
 this.Doc = this.Word.Documents.Open( this.TemplatePath );
 this.Doc.Activate();
 this.Range = this.Doc.Range();
 return true
 } catch(e) {
 //TODO: 如果用戶手動取消ActiveX的運行,則會留一WINWORD.EXE的進程。
 //除非"設為可信站點,并在自定義級別里將第二項啟用",則不會出現啟用ActiveX的對話框。
 try {
 if ( this.Doc ) { this.Doc.Close(0) };
 if ( this.Word ) { this.Word.Quit() }
 }
 catch (e){}
 return false
 }
 }
*/
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 玉门市| 蒲城县| 澄江县| 新密市| 扬中市| 兴海县| 汕头市| 土默特右旗| 湖北省| 华蓥市| 宁陵县| 松原市| 甘孜县| 永安市| 子洲县| 浦城县| 临夏市| 荆州市| 吉安县| 台北县| 辽源市| 恩平市| 青州市| 汶川县| 揭阳市| 商河县| 明溪县| 台中县| 古浪县| 仪陇县| 汤阴县| 正宁县| 张家港市| 武山县| 余干县| 北安市| 菏泽市| 万载县| 巨鹿县| 集安市| 冕宁县|