Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> new document </title>
<Meta name = "generator" content = "editplus"/>
<Meta name = "author" content = ""/>
<Meta name = "keywords" content = ""/>
<Meta name = "description" content = ""/>
<Script language = "javascript">
<! --
Function AutomateExcel ()
{
// Start Excel and get Application object.
Var oXL = new ActiveXObject ("Excel. Application ");
// Get a new workbook.
Var oWB = oXL. Workbooks. Add ();
Var oSheet = oWB. ActiveSheet;
Var table = document. all. data;
Var hang = table. rows. length;
Var lie = table. rows (0). cells. length;
// Add table headers going cell by cell.
For (I = 0; I {
For (j = 0; j <lie; j ++)
{
// OSheet. Cells (I + 1, j + 1). Font. Bold = True
// OSheet. Cells (I + 1, j + 1). Font. Size = 50
// OSheet. Cells (I + 1, j + 1). Alignment = 2
OSheet. Cells (I + 1, j + 1). value = table. rows (I). cells (j). innerText;
}
}
OXL. Visible = true;
OXL. UserControl = true;
}
// -->
</SCRIPT>
</Head>
<Body>
<Table border = "1" width = "100%" id = "data">
<Tr>
<Td> name </td>
<Td colspan = "2"> age </td>
<Td> Date of Birth </td>
</Tr>
<Tr>
<Td> 6 </td>
<Td> 25 </td>
<Td colspan = "2"> 8 </td>
</Tr>
<Tr>
<Td height = "22"> 1 </td>
<Td height = "22"> 2 </td>
<Td colspan = "2" height = "22"> 4 </td>
</Tr>
</Table>
<Input type = "button" name = "out_excel" onclick = "AutomateExcel ();" value = "export to excel" class = "notPrint">
</Body>
</Html>