[Javascript] Excel API

vijaykumar bavareddy abvijayreddy at gmail.com
Sat Nov 11 01:23:23 CST 2006


function ToExcel()
            {
            if (window.ActiveXObject)
            {
            var  xlApp = new ActiveXObject("Excel.Application");
            var xlBook = xlApp.Workbooks.Add();
            xlBook.worksheets("Sheet1").activate;
            var XlSheet = xlBook.activeSheet;
            xlApp.visible = true;
            var hdrcol=document.getElementsByName("hdrcol");
            var nRowsCount=pshipGrid.getRowsNum();
            var nColCount=pshipGrid.getColumnCount();
            for(var P = 1; P<=nRowsCount ; P++)
            {
            for(var Q = 1; Q < nColCount; Q++)
            {
            if (P==1)
            {
            XlSheet.cells(P ,Q).value =  hdrcol.item(Q).innerHTML;
            }
             var cell=pshipGrid.cells(P,Q);
             XlSheet.cells(P +1,Q).value = cell.getValue();
            }
            }
            XlSheet.columns.autofit;
            }
            }//end function

Hi above code am using to create Excel document for grid data using
javascript and Activex object.. but problem is i just want do this without
using Activex object(Excel.Application).. and it should work in both IE and
FF in Windows OS..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20061111/28e95d72/attachment.htm>


More information about the Javascript mailing list