-1
나는 C#을하지만 경우 개방에서 Excel로 HTML 테이블을 수출하고
에 HTML 테이블을 내보내는이 같이 나에게 오류를주고있다 엑셀 때 : 얻기 형식 오류가 엑셀
나는 "와 다른 확장을 시도 office document.spreadsheetml.sheet "같은 .xlsx 여전히 동일한 오류가 발생합니다. 아래는 C# 코드입니다.
//StrExport.Append(@"<html xmlns='urn:schemas-microsoft-com:office:Spreadsheet' xmlns:ss='urn:schemas-microsoft-com:office:Spreadsheet' xmlns='http://www.w3.org/TR/REC-html40'><head><title>Time</title>");
//StrExport.Append(@"<body lang=EN-US id=h1><div class=Section1>");
StrExport.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>Time</title>");
StrExport.Append(@"<body lang=EN-US style='mso-element:header' id=h1><span style='mso--code:DATE'></span><div class=Section1>");
StrExport.Append("<DIV style='font-size:12px;'>");
StrExport.Append(dvInfo.InnerHtml);
StrExport.Append("</div></body></html>");
string strFile = "StudentInformations.xls";
// string strFile = "StudentInformations.xlsx";
string strcontentType = "application/excel";
//string strcontentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.ClearContent();
Response.ClearHeaders();
Response.BufferOutput = true;
Response.ContentType = strcontentType;
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFile);
Response.Write(StrExport.ToString());
Response.Flush();
Response.End();
이 메시지를 해결하십시오.
또한 확장명을 .xlsx로 설정했지만 xlsx가 설정되지 않으면 Excel이 열리지 않습니다. –
@jitendrakumar _content_는 확장 물이 아니라 중요한 사항입니다. PNG로 확장을 설정하는 방법; 마술처럼 내용을 이미지로 만드나요? –
@uwe Keim 모든 솔루션 ?? –