/**************************************************************
Html Export Functions
1?Export Html to Excel File;
2?Export Html to Word File;

Now,for some reason,this function only use to export the key
element of html to Excel or Word.

gf 2005.12.16
**************************************************************/

function exportToExcel(obj)
{
	alert("ok");
	//Connect to Excel Application  and get it.
	try
	{
		excelApplication = new ActiveXObject("Excel.Application"); 
	}
	catch(e)
	{
		alert("????excel???????????????Excel????????????<ActiveX??>!");
		return;
	}
	
	//During the Exporting Process, Excel will be visibled or not ?
	if (ProcVisible="true")
	{
		excelApplication.visible = true;
	}
	else
	{
		excelApplication.visible = false;
	}
	
	//Get the Excel Workbook
	excelWorkbook = excelApplication.Workbooks.Add();
	
	//Get the Excel Actived Sheet
	excelActiveSheet = excelWorkbook.ActiveSheet;
	
	//Get the data in the Table and Export the data to Excel File.
	var sel=document.body.createTextRange();
//	var table=document.documentElement.getElementById("PrintA");
	
//	var table=document.getElementById(obj);
	var table=document.body;

	sel.moveToElementText(table);
	sel.select();
	sel.execCommand("Copy");
	excelActiveSheet.Paste();
	
	sel.execCommand("Unselect");
	
	/*
	var Lenr = Obj.rows.length;
	for (i=0;i<Lenr;i++) 
  	{ 
   		var Lenc = Obj.rows(i).cells.length; 
   		for (j=0;j<Lenc;j++) 
   		{ 
    		excelActiveSheet.Cells(i+1,j+1).value = Obj.rows(i).cells(j).innerText; 
   		} 
  	}
  	*/
  	
  	//End the Excel thread , and Exit;
  	excelApplication.Quit();
  	excelApplication=null;
	window.setInterval("Cleanup();",1);
}