1. 程式人生 > >C# 快遞單批量列印

C# 快遞單批量列印

接著上一個單個快遞單列印來做個升級

     最主要就是在調取排版的時候有變化

<script>
        function myPrintSetupyundaBatchPrint() {//批量列印韻達快遞單
            LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
            LODOP.PRINT_INITA(0, 0, 1500, 1100, "列印");
            LODOP.SET_SHOW_MODE("BKIMG_TOP", -25);
            LODOP.SET_PRINT_PAGESIZE(1, 2300, 1290, "CreateCustomPage");
            //  LODOP.SET_PRINTER_INDEX(getSelectedPrintIndex());
            LODOP.ADD_PRINT_SETUP_BKIMG("<img border='0' src='imgs/yunda.jpg'>");
            LODOP.SET_SHOW_MODE("BKIMG_IN_PREVIEW", true);
            // LODOP.SET_PRINT_STYLE("FontName", "微軟雅黑");
            LODOP.SET_PRINT_STYLE("FontSize", 11);
            //LODOP.SET_PRINT_STYLE("Bold", 1);  
            var slist = Array();
            slist = document.getElementById("<%=HiddenField1.ClientID %>").value.toString().split('^');
            for (i = 0; i < slist.length; i++) {
                var s = Array();
                s = slist[i].toString().split('~');
                LODOP.NewPage();
                LODOP.ADD_PRINT_TEXT(50, 59, 233, 23, s[0]);
                LODOP.ADD_PRINT_TEXT(74, 129, 75, 23, s[10]);
                LODOP.ADD_PRINT_TEXT(123, 114, 263, 70, s[7]);
                LODOP.ADD_PRINT_TEXT(182, 609, 120, 21, s[4]);
                LODOP.ADD_PRINT_TEXT(123, 403, 276, 68, s[3]);
                LODOP.SET_PRINT_STYLEA(0, "LineSpacing", 10);
                //  LODOP.ADD_PRINT_TEXT(377, 462, 195, 50, s[5]);
                //  LODOP.SET_PRINT_STYLEA(0, "FontSize", 9);
                LODOP.ADD_PRINT_TEXT(206, 154, 113, 23, s[9]);
                LODOP.ADD_PRINT_TEXT(77, 657, 120, 38, s[2]);
                LODOP.SET_PRINT_STYLEA(0, "LineSpacing", 1);
                LODOP.ADD_PRINT_TEXT(77, 461, 110, 35, s[1]);
                LODOP.ADD_PRINT_TEXT(77, 276, 100, 23, s[8]);
                var mdate = new Date();
                LODOP.ADD_PRINT_TEXT(362, 180, 45, 23, mdate.getFullYear());
                LODOP.ADD_PRINT_TEXT(362, 230, 25, 23, mdate.getMonth() + 1);
                LODOP.ADD_PRINT_TEXT(362, 260, 25, 23, mdate.getDate());
                LODOP.ADD_PRINT_TEXT(362, 290, 25, 23, mdate.getHours());
            }
            //  LODOP.PRINT_SETUP(); //維護模式
            //  LODOP.PRINT_DESIGN(); //設計模式
            LODOP.PREVIEW(); //預覽模式
        };
    </script>

看出變化了?

就是將讀取的資料先分割成一個數組{[1,2],[3.4]},分別讀取