织梦CMS - 轻松建站从此开始!

罗索

当前位置: 主页>杂项技术>Web>

js调用OWC(Office Web Component)来生成Excel的一个例程

罗索客 发布于 2004-03-01 14:54 点击:次 
if (printWindow !printWindow.closed) { alert(?磅︽?更?穨!); return; } printWindow = window.open(,ResultPage,top=0,left=0,height=+window.screen.availheight+,width=+window.screen.availwidth+,status=yes,toolbar=yes,menubar=yes) ; printWindow. documen
TAG:

        if (printWindow && !printWindow.closed)
        {
            alert("?磅︽?更?穨!");
            return;
        }
              
        printWindow = window.open("","ResultPage","top=0,left=0,height="+window.screen.availheight+",width="+window.screen.availwidth+",status=yes,toolbar=yes,menubar=yes") ;
        printWindow.document.writeln("<object id=Spreadsheet1 classid=CLSID:0002E510-0000-0000-C000-000000000046 style=''width:100%;height:800''></object>") ;
        printWindow.document.writeln("<script language=''javascript''> ");
        printWindow.document.writeln("Spreadsheet1.DisplayToolbar = true ;");
        printWindow.document.writeln("Spreadsheet1.ActiveSheet.Cells.Clear() ;");
        printWindow.document.writeln("Spreadsheet1.ActiveSheet.Cells.ColumnWidth=100;");
        bFirst=true;
        iPos=1;
        
        if (unixml.GetMRSCount("DataList/Detail/Line") != 0)
        {
            for(var i=0; i<unixml.GetMRSCount("DataList/Detail/Line"); i++)
            {
                var xDetail = unixml.XMLDoc.selectSingleNode("/UniMSG/DataList/Detail/Line[" + i + "]");
                
                if(xDetail==null)
                    return;
                for (var s=0; s < xDetail.childNodes.length; s++)
                {
                    if(bFirst)
                    {
                        var aaa = "";
                        aaa=GetDescription(xDetail.childNodes.item(s).nodeName);
                                        
                        if (aaa == "" ){
                            aaa = xDetail.childNodes.item(s).nodeName;
                        }
                        printWindow.document.writeln("Spreadsheet1.ActiveSheet.Cells(" + eval(3 + i)  + "," + eval(s+1) + ") =''" + aaa +"'' ;") ;
                        iPos=1+parseInt(xDetail.childNodes.length/2);
                    }
                    printWindow.document.writeln("Spreadsheet1.ActiveSheet.Cells(" + eval(4 + i)  + "," + eval(s+1) + ") =\\"''" + xDetail.childNodes.item(s).text +"\\" ;") ;
                }
                bFirst=false;
            }
        }else{
            printWindow.document.writeln("Spreadsheet1.ActiveSheet.Cells(2,2) = ''琩礚戈?'' ; ") ;
        }
        printWindow.document.writeln("Spreadsheet1.ActiveSheet.Cells(1,"+iPos+") = ''" + mcboPrintData.options[mcboPrintData.selectedIndex].text + "'' ; ") ;//基本资料列印

        printWindow.document.writeln("</script>") ;  
(iwgh)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/200403/424.html]
本文出处: 作者:iwgh
顶一下
(0)
0%
踩一下
(2)
100%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容