File size: 3,559 Bytes
9ba1976
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<head>
<title>��ţ��</title>
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/pluginsCss.css" />
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/plugins.css" />
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/luckysheet.css" />
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/iconfont.css" />
<script src="https://huggingface.co/spaces/changxin/highcharts/raw/main/plugin.js"></script>
<script src="https://huggingface.co/spaces/changxin/highcharts/raw/main/luckysheet.umd.js"></script>
<script>
    $(function () {
        var options = {
            container: "pq",
            title: "���IJ���",
            lang: "zh",
            myFolderUrl: "https://pbihub.cn/users/44",
            userInfo: {userName:"����"},
            data: [{"name":"��ˮ","index":0,"status":1,"order":0,"color":"#ff0066","row":18,"column":12,"celldata":luckysheet.transToCellData([["ά�ȱ�","����ֵ����","����ʽ"],])}]
        }
        luckysheet.create(options)
    })
</script>
</head>
    <body>
        <div id="md" style="position: absolute;z-index: 1000000;left: 0px;top: 0px;bottom: 0px;right: 0px; background: rgba(255, 255, 255, 0.8); text-align: center;font-size: 40px;align-items:center;justify-content: center;display: none;">Downloading</div>
        <p style="text-align:center;"> <input style="font-size:16px;" type="file" id="test" name="test" change="demoHandler" /></p>
        <div id="pq" style="margin:0px;padding:0px;position:absolute;width:100%;left: 0px;top: 50px;bottom: 0px;outline: none;"></div>
        <script src="https://huggingface.co/spaces/changxin/highcharts/raw/main/luckyexcel.umd.js"></script>
        <script>
            function demoHandler(){
                let upload = document.getElementById("test");
                let mask = document.getElementById("md");
                if(upload){
                    
                    window.onload = () => {                        
                        upload.addEventListener("change", function(evt){
                            var files = evt.target.files;
                            if(files==null || files.length==0){alert("û�д������ļ���");return;}

                            let name = files[0].name;
                            let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
                            if(suffix!="xlsx"){alert("Ŀǰֻ֧��xlsx�ĵ����룡");return;}
                            LuckyExcel.transformExcelToLucky(files[0], function(exportJson, luckysheetfile){
                                
                                if(exportJson.sheets==null || exportJson.sheets.length==0){alert("��ȡʧ��, Ŀǰ��֧��xls�ļ�!");return;}
                                console.log(exportJson, luckysheetfile);
                                window.luckysheet.destroy();
                                
                                window.luckysheet.create({
                                    container: 'pq',
                                    showinfobar:false,
                                    data:exportJson.sheets,
                                    title:exportJson.info.name,
                                    userInfo:exportJson.info.name.creator
                                });
                            });
                        });
                    }
                }
            }
            demoHandler();
        </script>
    </body>