cy
2022-06-28 2ba5c891b24d4d0cd6ce7ef833592e4f576ee5e8
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
<script type="text/javascript">
var staticUrl = '${base}';
</script>
<script language="javascript" src="${common_static}/static/plugins/print/LodopFuncs.js"></script>
<script type="text/javascript">
    
    var LODOP; //声明为全局变量 
    
    //A4打印 type: 1=横向 2=纵向
    function printA4(type,dom) {
        LODOP=getLodop();
        CreateOneFormPage(type,dom);
        LODOP.PREVIEW();
    };
    
    
    
    function CreateOneFormPage(type,dom){
        var strStyleCSS="<link href='${common_static}/static/ui/css/printa4-table.css' type='text/css' rel='stylesheet'>";
        var strFormHtml=strStyleCSS+"<body>"+document.getElementById(dom).innerHTML+"</body>";
        LODOP.SET_PRINT_PAGESIZE(type,0,0,"A4");
        LODOP.SET_PRINT_STYLEA(1,"Angle",90);
        LODOP.ADD_PRINT_HTM("1.0cm","0.5cm","RightMargin:0.9cm","BottomMargin:9mm",strFormHtml);
    };
    
    function exportXls(name){ 
        LODOP=getLodop();
        LODOP.PRINT_INIT("");
        LODOP.ADD_PRINT_TABLE(100,20,500,80,document.documentElement.innerHTML); 
        LODOP.SET_SAVE_MODE("Orientation",2); //Excel文件的页面设置:横向打印   1-纵向,2-横向;
        LODOP.SET_SAVE_MODE("PaperSize",9);  //Excel文件的页面设置:纸张大小   9-对应A4
        LODOP.SET_SAVE_MODE("Zoom",90);       //Excel文件的页面设置:缩放比例
        LODOP.SET_SAVE_MODE("CenterHorizontally",true);//Excel文件的页面设置:页面水平居中
        LODOP.SET_SAVE_MODE("CenterVertically",true); //Excel文件的页面设置:页面垂直居中
        LODOP.SAVE_TO_FILE(name+".xls"); 
     }
     
     function exportXlsById(id,name){
        LODOP=getLodop();
        LODOP.PRINT_INIT("");
        LODOP.ADD_PRINT_TABLE(100,20,500,80,document.getElementById(id).innerHTML);
        LODOP.SET_SAVE_MODE("Orientation",2); //Excel文件的页面设置:横向打印   1-纵向,2-横向;
        LODOP.SET_SAVE_MODE("PaperSize",9);  //Excel文件的页面设置:纸张大小   9-对应A4
        LODOP.SET_SAVE_MODE("Zoom",90);       //Excel文件的页面设置:缩放比例
        LODOP.SET_SAVE_MODE("CenterHorizontally",true);//Excel文件的页面设置:页面水平居中
        LODOP.SET_SAVE_MODE("CenterVertically",true); //Excel文件的页面设置:页面垂直居中
        LODOP.SAVE_TO_FILE(name+".xls");
     }
 
    function onDialogBtnClick(btnID, dialogID, config){//此函数放在子页面
        if(btnID == "btnExport"){
            saveAsFile();
        }
        if(btnID == "btnPrint"){
            prn1_preview();
        }
    }
    </script>