私はASP:テーブルをExcelにエクスポートする必要があるという問題があります。 Excelへのエクスポートは正常に機能するので、ここに私の現在のコードがあります。複数のExcelワークシートを持つASP.NET C#Excelエクスポータ
string[] htmlTableString = generateHtmlTable(divs);
StringBuilder sb_ExcelData = new StringBuilder();
sb_ExcelData.Append(@"<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'><head><title>KzB</title>");
sb_ExcelData.Append(@"<body lang=EN-US style='mso-element:header' id=h1><span style='mso--code:DATE'></span><div class=Section1>");
sb_ExcelData.Append("<DIV style='font-size:12px;'>");
sb_ExcelData.Append(htmlTableString[0]); // HERE IS MY PROBLEM
sb_ExcelData.Append("</div></body></html>");
string strFile = "Kzb_"+"Jahr_"+dd_Year.SelectedValue+ "_Export_" + DateTime.Now.Day.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString() + ".xls";
string strcontentType = "application/excel";
Response.ClearContent();
Response.ClearHeaders();
Response.BufferOutput = true;
Response.ContentType = strcontentType;
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFile);
Response.Write(sb_ExcelData.ToString());
Response.Flush();
Response.Close();
Response.End();
コードには、[] htmlTableStringという文字列があります。私のASP:Table Contentがあります。今私はExcelで新しいシート/ワークシート/タブを含む各文字列を表示したいと思います。だから私はどのようにこの機能を得ることができますか?
私は多くを検索しましたが、私は外部ライブラリを使用したくありません。
私の現在のコードで解決策を得る可能性はありませんか?私はそれがこのような方法で働かないと信じていない –
あなたは私に解決策を与えることができますか? –