zoukankan      html  css  js  c++  java
  • 几个js写word的参考

    /*
    给几个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
     }
     }
    */
  • 相关阅读:
    Project Euler 81:Path sum: two ways 路径和:两个方向
    Project Euler 80:Square root digital expansion 平方根数字展开
    Project Euler 79:Passcode derivation
    lintcode 中等题:Intersection of Two Linked Lists 两个链表的交叉
    lintcode 中等题:Divide Two Integers 两个数的除法
    lintcode 中等题 :Maximum Product Subarray 最大连续乘积子序列
    lintcode:First Missing Positive 丢失的第一个正整数
    山丘
    在山的那边
    lintcode :Ugly Numbers 丑数
  • 原文地址:https://www.cnblogs.com/qingshan/p/1590015.html
Copyright © 2011-2022 走看看