I am trying to create an html/xml that will load data in 2 different worksheets into excel 2000.
the following code create 2 worksheets, but put all the data into the first one.
Is anybody can tell me what has to be done to be able to write the data to the second worksheet?
- Code: Select all
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 9">
</head>
<body link=blue vlink=purple>
<!-- Creation of 2 worksheets ( data1 and data2 ) -->
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>data1</x:Name>
<x:WorksheetOptions>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
<x:ExcelWorksheet>
<x:Name>data2</x:Name>
<x:WorksheetOptions>
<x:Selected/>
<x:ProtectContents>False</x:ProtectContents>
<x:ProtectObjects>False</x:ProtectObjects>
<x:ProtectScenarios>False</x:ProtectScenarios>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
<x:ProtectStructure>False</x:ProtectStructure>
<x:ProtectWindows>False</x:ProtectWindows>
</x:ExcelWorkbook>
</xml>
<!-- Fill up the first worksheet -->
<table x:str border=0 cellpadding=0 cellspacing=0 width=128 style='border-collapse:
collapse;table-layout:fixed;width:96pt'>
<col width=64 span=2 style='width:48pt'>
<tr height=17 style='height:12.75pt'>
<td height=17 width=64 style='height:12.75pt;width:48pt'>S1_R1_C1</td>
<td width=64 style='width:48pt'>S1_R1_C2</td>
<td width=64 style='width:48pt'>S1_R1_C3</td>
</tr>
<tr height=17 style='height:12.75pt'>
<td height=17 width=64 style='height:12.75pt;width:48pt'>S1_R2_C1</td>
<td width=64 style='width:48pt'>S1_R2_C2</td>
<td width=64 style='width:48pt'>S1_R2_C3</td>
</tr>
</table>
<!-- Should activate the second worksheet -->
<xml>
<x:ExcelWorkbook>
<x:ActiveSheet>1</x:ActiveSheet>
</x:ExcelWorkbook>
</xml>
<!-- Should fillup the second worksheet -->
<!-- S2_R1_C1 S2_R1_C2 S2_R1_C3 -->
<!-- S2_R2_C1 S2_R2_C2 -->
<table x:str border=0 cellpadding=0 cellspacing=0 width=128 style='border-collapse:
collapse;table-layout:fixed;width:96pt'>
<col width=64 span=2 style='width:48pt'>
<tr height=17 style='height:12.75pt'>
<td height=17 width=64 style='height:12.75pt;width:48pt'>S2_R1_C1</td>
<td width=64 style='width:48pt'>S2_R1_C2</td>
<td width=64 style='width:48pt'>S2_R1_C3</td>
</tr>
<tr height=17 style='height:12.75pt'>
<td height=17 style='height:12.75pt'>S2_R2_C1</td>
<td>S2_R2_C2</td>
</tr>
</table>
</body>
</html>
If you are saving the code into a file (test.htm) you will be able to load it into excel but all the data will be into the worksheet (data1) and the cursor will end on the worksheet (data2) without any data in it.
I cannot have more than 1 html/xml file. That file will be generated by a 3rd party program.
Any suggestion will be highly appreciated.
stjacqd



