将Html表格发送到多个Excel表格

我有两个HTML表,我想放在同一个Excel文件的2张不同的表。 我正在使用ASP.net MVC3并发送FileResult到我的页面。

FileResult包含以下内容(减去string生成器):

StringBuilder sb = new StringBuilder(); sb.Append("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">"); sb.Append("<head>"); sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html;charset=windows-1252\">"); sb.Append("<!--[if gte mso 9]>"); sb.Append("<xml>"); sb.Append("<x:ExcelWorkbook>"); sb.Append("<x:ExcelWorksheets>"); sb.Append("<x:ExcelWorksheet>"); sb.Append(String.Format("<x:Name>{0}</x:Name>", ExcelSheetName)); sb.Append("<x:WorksheetOptions>"); sb.Append("<x:Panes></x:Panes>"); sb.Append("</x:WorksheetOptions>"); sb.Append("</x:ExcelWorksheet>"); // sheet 2 sb.Append("<x:ExcelWorksheet>"); //sb.Append("<x:Table/>"); //sb.Append("<x:Column x:Width=\"500\" />"); //sb.Append("<x:Column x:Width=\"500\" />"); //sb.Append("</x:Table/>"); sb.Append(String.Format("<x:Name>Sheet2_Test</x:Name>")); //sb.Append("<Table ss:ExpandedColumnCount=\"2\" ss:ExpandedRowCount=\"5\" x:FullColumns=\"1\" x:FullRows=\"1\">"); //sb.Append("<Row><Cell><Data ss:Type=\"String\">Text in cell A1</Data></Cell></Row>"); //sb.Append("<Row><Cell ss:StyleID=\"s21\"><Data ss:Type=\"String\">Bold text in A2</Data></Cell></Row>"); //sb.Append("<Row ss:Index=\"4\"><Cell ss:Index=\"2\"><Data ss:Type=\"Number\">43</Data></Cell></Row>"); //sb.Append("<Row><Cell ss:Index=\"2\" ss:Formula=\"=R[-1]C/2\"><Data ss:Type=\"Number\">21.5</Data></Cell></Row>"); //sb.Append("</Table>"); sb.Append("<x:WorksheetOptions>"); sb.Append("<x:Panes></x:Panes>"); sb.Append("</x:WorksheetOptions>"); sb.Append("</x:ExcelWorksheet>"); sb.Append("</x:ExcelWorksheets>"); sb.Append("</x:ExcelWorkbook>"); sb.Append("</xml>"); sb.Append("<![endif]-->"); 

然后我添加我的HTML表,并返回结果。 它工作得很好,我得到了第二张表,但我不知道如何写入第二张。 有谁知道如何写入第二张使用这种方法?

每个表都应该有自己的<Worksheet>元素。 每个<Worksheet>节点都有自己的<Table>元素,它具有一个或多个<Row>元素,它具有一个或多个<Cell>元素。