Home > Web Front-end > JS Tutorial > Several reference codes for javascript operations on word_javascript skills

Several reference codes for javascript operations on word_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:43:16
Original
984 people have browsed it
Copy code The code is as follows:

/*
A reference for several js writing words :
this.Word.Selection.Font.Size = 16; //Font size
this.Word.Selection.Font.Bold = true; //Whether to bold
this .Word.Selection.ParagraphFormat.Alignment = 2; //0 is left aligned, 1 is centered, 2 is right aligned, numbers can only be 0-9, try it slowly
this.Word.Selection.InsertRowsBelow(1) ; //Add a line below
this.Word.Selection.MoveRight(1); //Move the cursor right
this.Word.Selection.TypeText(string); //Only strings can be written
this.Word.Selection.MoveDown(); //The cursor moves down
this.Word.Selection.EndKey(); //The cursor moves to the end
this.Word.ActiveDocument .Sections(1).Headers(1).Range.InsertAfter(string); //Write the header, and write
this._LoadData = function () {
//Replace the function, Used to replace text of type $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) )
 }
//Initialize Word control
 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: If the user manually cancels the running of ActiveX, a WINWORD.EXE process will be left. .
 //Unless "Set as a trusted site and enable the second item in the custom level", the dialog box to enable ActiveX will not appear.
 try {
 if ( this.Doc ) { this.Doc.Close(0) };
 if ( this.Word ) { this.Word.Quit() }
 }
 catch (e){}
 return false
 }
 }
*/
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template