其他分享
首页 > 其他分享> > 【JS】WPS宏编辑器

【JS】WPS宏编辑器

作者:互联网

摘自:https://blog.csdn.net/liuzhicheng1845/article/details/120758263

https://open.wps.cn/docs/office
https://www.cnblogs.com/nutix/p/15189657.html

excel处理

function test1(){//文本问题检索
    var all=""
    for(var i=200;i<=400;i++){
        if(get(i,3)==1)
            all=all+get(i,2)+"\n"
    }
    all=all+""
    set(1,5,all)
}
function test1(){
    for(var i=1;i<10;i++){
        Sheets.Item(2).Range("A"+i).Value2=i
        Sheets.Item(1).Range("B"+(i+1)).Value2=Sheets.Item(2).Range("A"+i).Value2
    }
}
function test2(){
    var p=[]
    for(var i in Sheets)
        p.push(i)
    return p
}

 

//从22*4的区域中读取数据
function get(i,j){
    var n="A".charCodeAt()
    j=String.fromCharCode(n+j-1)
    return Sheets.Item(1).Range(j+i).Value2
}
function set(i,j,e){
    var n="A".charCodeAt()
    j=String.fromCharCode(n+j-1)
    Sheets.Item(1).Range(j+i).Value2=e
}
function test1(){
    var all="["
    for(var i=1;i<=22;i++){
        all=all+"["
        for(var j=1;j<=4;j++){
            var v=get(i,j)
            if(typeof(v)=="undefined")v=0
            if(j==4)all=all+v
            else all=all+v+","
        }
        all=all+"]"
        if(i!==22)
            all=all+","
    }
    all=all+"]"
    set(25,5,all)
}

 

function get(i,j){
    var n="A".charCodeAt()
    j=String.fromCharCode(n+j-1)
    return Sheets.Item(1).Range(j+i).Value2
}
function set(i,j,e){
    var n="A".charCodeAt()
    j=String.fromCharCode(n+j-1)
    Sheets.Item(1).Range(j+i).Value2=e
}
function getA(){
    return [[1953069,1952815,0,0],[1953348,1953066,1953196,0],[1953902,1851881,0,0],[1950679,1950444,0,0],[1952335,1951106,0,0],[1953082,0,0,0],[1952647,0,0,0],[1850061,0,0,0],[1954090,0,0,0],[1952723,1950055,0,0],[1953910,0,0,0],[1950994,0,0,0],[1951724,1953603,1952230,0],[1951098,1953280,0,0],[1853287,0,0,0],[1951328,1951593,0,0],[1952350,0,0,0],[1952528,1854117,0,0],[1952102,1952531,0,0],[1950062,1950071,1950641,1952897],[1851009,1850091,1852461,0],[1951095,1853692,0,0]]
}
function test1(){//用于生成统计姓名的表格
var a=getA()
var b=[]
for(var i=0;i<a.length;i++)
for(var j=0;j<a[i].length;j++)
    if(a[i][j]!==0)b.push(["第"+(i+1)+"组",a[i][j]])
for(var i=0;i<b.length;i++)
{
set(3+i,1,b[i][0])
set(3+i,2,b[i][1])
}

}
function test2(){//统计完姓名后执行
var a=getA()
var b=[]
var s=""
var k=3
for(var i=0;i<a.length;i++){
    s+="第"+(i+1)+"组\n"
    var s0=""
    for(var j=0;j<a[i].length;j++)
    if(a[i][j]!==0){
        s0+=get(k,4)+" "
        s+=get(k,2)+"  "+get(k,4)+"\n"
        k++
    }
    set(i+1,5,s0)
}

set(44,8,s)
}

{undefined
Application,
_Default,
Arrange,
Parent,
BreakSideBySide,
Creator,
Count,
Item,
_NewEnum,
CompareSideBySideWith,
SyncScrollingSideBySide,
ResetPositionsSideBySide

}
ppt处理

标签:function,charCodeAt,JS,Item,编辑器,Sheets,var,WPS,String
来源: https://www.cnblogs.com/LiuYanYGZ/p/16061768.html