ホームページ  >  記事  >  ウェブフロントエンド  >  word_javascript スキルに関する JavaScript 操作のいくつかのリファレンス コード

word_javascript スキルに関する JavaScript 操作のいくつかのリファレンス コード

WBOY
WBOYオリジナル
2016-05-16 18:43:16895ブラウズ
コードをコピー コードは次のとおりです:

/*
いくつかの JS のリファレンス単語の書き込み :
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); //文字列のみ記述可能
this.Word.Selection.MoveDown() //カーソルが下に移動します
this.Word.Selection.EndKey(); //カーソルが下に移動しますend
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.Range = this.Doc.Range();
 return true
 } catch(e) {
 //TODO: ユーザーが手動でキャンセルした場合ActiveX を実行すると、WINWORD.EXE プロセスが残ります。
 //「信頼済みサイトとして設定し、カスタム レベルの 2 番目の項目を有効にする」を行わない限り、ActiveX を有効にするダイアログ ボックスは表示されません。
 try {
 if ( this.Doc ) { this.Doc.Close(0) };
 if ( this.Word ) { this.Word.Quit() }
 }
 catch (e){}
 return false
 }
 }
*/

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。