excel 导出 多个sheet页
如何将多个组好的文本如下(<html><head><title></title></head><body>里面是带样式的table</body></html>)
导入到各个sheet页 --------------------编程问答-------------------- /// <summary> /// 将DataTable转换为WorkSheet /// </summary> /// <param name="dataTable"></param> /// <returns></returns> private static string TableToWorksheet(DataTable dataTable) { if (null==dataTable||dataTable.Rows.Count==0) { return string.Empty; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<Worksheet ss:Name='" + dataTable.TableName.ToString() + "'>"); stringBuilder.Append("<Table x:FullColumns='1' x:FullRows='1'>"); //输出标题 stringBuilder.Append("rn<Row ss:AutoFitHeight='1'>"); foreach (DataColumn tableColumn in dataTable.Columns) { stringBuilder.AppendFormat("<Cell ss:StyleID='Header'><Data ss:Type='String'>{0}</Data></Cell>", tableColumn.ColumnName.ToString()); } stringBuilder.Append("rn</Row>"); foreach(DataRow row in dataTable.Rows) { stringBuilder.Append("<Row>"); foreach (DataColumn tableColumn in dataTable.Columns) { stringBuilder.AppendFormat("<Cell ss:StyleID='border'><Data ss:Type='String'>{0}</Data></Cell>", row[tableColumn].ToString()); } stringBuilder.Append("</Row>"); } stringBuilder.Append("</Table>"); stringBuilder.Append("</Worksheet>"); return stringBuilder.ToString(); } --------------------编程问答-------------------- 是组好的字符串
(<html><head><title></title></head><body>带样式的table</body></html>)
导入到各个sheet页
补充:.NET技术 , ASP.NET