| function
sendtoexcel(stoexcel){ |
var blnflag;
var z;
var flg1;
var flg2;
var flg3;
var flg4;
var docurl=document.location.href;
var docarr=docurl.split("=");
if(docarr.length>5){
flg1=docurl.split("=");
flg3=docarr[5].split("=");
flg4=docarr[6].split("=");
flg2=flg3[0].substr(0,1);
z=flg4; |
| |
}
if(z==null){
var d=new Date();
var month=d.getMonth();
var year=d.getYear();
var h=d.getHours();
var m=d.getMinutes();
var s=d.getSeconds();
var d=d.getDate();
flname="A"+d+month+year+h+m+s+".XLS";
}
else
{
flname=z;
} |
var exApp;
var ActiveSheet ;
var blnflag
if(flg2=="T"){ |
var pgnum=".__listCtl.thisPage}";
if(pgnum==""){
pgnum=1;
}
var s=".__listCtl.pagingAmount}";
if(s==""){
s=1;
}
if (pgnum
== 1)
{
exApp = new ActiveXObject("Excel.Application")
exApp.Visible=true;
exApp.Workbooks.Add;
exApp.Worksheets.Add;
ActiveSheet = exApp.Workbooks(1).Worksheets(1);
blnflag="False"; |
}
else
{
exApp = GetObject(flname,"Excel.Sheet");
blnflag="True";
}
var i=2;
var j=2; |
|
|
|
exApp.ActiveSheet.Cells(i,j).Value="
#";
j=j+2;
<list root.nonLeafChildren["0"].children as
child>
<if !child.isPrimaryKey || child.type != "int">
exApp.ActiveSheet.Range("A2","Z2").Font.Bold=true;
exApp.ActiveSheet.Cells(i,j).Value="<if
child.isReverseKey>count</if>";
|
j=j+2;
</if>
</list>
i=i+2;
if(pgnum==1)
{
var i=4;
}
else
|
|
var
i=(s*pgnum)-(s-4);
}
< .
as e1>
< id e1.>
<assign seenFirstChild "no">
var j=2;
<list root.nonLeafChildren["0"].children as
child>
<if child.foreignKeyToTable>
< cellContent e1.__deref.derefValue>
exApp.ActiveSheet.Cells(i,j).Value = "e1.__deref.derefValue}";
|
<else>
< cellContent e1.>
exApp.ActiveSheet.Cells(i,j).Value = "e1.}";
</if>
j=j+2;
</list>
i=i+1;
</>
if(blnflag=="False")
{ |
exApp.ActiveSheet.SaveAS(flname);
var pgn=".__listCtl.pageList.size}";
if(pgn==""){
pgn=1;
}
if(parseInt(pgnum) != parseInt(pgn))
{
exApp.Workbooks.Close;
}
}
else
if(blnflag=="True")
|
{
exApp.windows(1).Visible = "True";
exApp.Save ;
}
var pgn=".__listCtl.pageList.size}";
if(pgn==""){
pgn=1;
}
if(pgnum==""){
pgnum=1;
}
if(parseInt(pgnum) < parseInt(pgn))
{ |
var
str="servlet_prefix/auto/list//pagingAction?search__id=search__id&paging__node=1&page__number="+(parseInt(pgnum)+parseInt(1))+"&order__by__1=.__listCtl.orderBy}&stoexcel=T&flname="+flname;
window.location.href=str;
}
if(parseInt(pgnum) == parseInt(pgn))
{
var str="servlet_prefix/auto/list//pagingAction?search__id=search__id&paging__node=1&page__number=1&order__by__1=.__listCtl.orderBy}";
window.location.href=str;
}
}
}
</script>
|
| |
| Back
to Excel Note |