File size: 1,316 Bytes
6e76f78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function fx(n){
    var a=1,b=1;
    for(i=2;i<=n;i++){[a,b]=[b,a+b]};
    return a
}
function onbuttonclick(idStr)
{
    switch(idStr)
    {
        case "fn":{
            let curSheet = wps.EtApplication().ActiveSheet;
            if (curSheet){
                curSheet.Cells.Item(1, 1).Formula="执一以为天下式" + curSheet.Cells.Item(1, 1).Formula
            }
            break;
        }
        case "fb":{
            const doc = wps.EtApplication().ActiveSheet;
            if (doc){
                const x=wps.EtApplication().InputBox('请输入需要生成的项序号','测试','5',200,200)
                doc.Cells.Item(1, 1).Formula=fx(Number(x))
            }
            break;
        }
        case "fn2":{
            const doc2 = wps.EtApplication().ActiveSheet
            if (doc2){
                doc2.Cells.Item(1, 1).Formula=document.querySelector("#畅心 > img").src
            }
            break;
        }
    }
}

window.onload = ()=>{
    var xmlReq = WpsInvoke.CreateXHR();
    var url = location.origin + "/.debugTemp/NotifyDemoUrl"
    xmlReq.open("GET", url);
    xmlReq.onload = function (res) {
        var node = document.getElementById("DemoSpan");
        window.document.getElementById("DemoSpan").innerHTML = res.target.responseText;
    };
    xmlReq.send();
}