올바른 구현 방법을 찾을 수있었습니다. 내보내기 ms 차트 (ms 차트 컨트롤)를 사용하여 이미지로 탁월합니다. 나는 그것을 여기에서 공유하게되어 기쁘다. 올바른 소스 코드 샘플은 다음과 같습니다.
string tmpChartName = "test2.jpg";
string imgPath = HttpContext.Current.Request.PhysicalApplicationPath + tmpChartName;
Chart1.SaveImage(imgPath);
string imgPath2 = Request.Url.GetLeftPart(UriPartial.Authority) + VirtualPathUtility.ToAbsolute("~/" + tmpChartName);
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=test.xls;");
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
string headerTable = @"<Table><tr><td><img src='" + imgPath2 + @"' \></td></tr></Table>";
Response.Write(headerTable);
Response.Write(stringWrite.ToString());
Response.End();
감사합니다 :)
당신은 실제로 단지 .XLS으로 이미지를 저장하는 것보다 처음이 아니라 스프레드 시트를 작성해야 할거야! [이 라이브러리 중 하나를 사용해보십시오] (http://stackoverflow.com/questions/151005/create-excel-xls-and-xlsx-file-from-c-sharp) – Rup
@Rup - 빠른 응답을 보내 주셔서 대단히 감사합니다. 제안. 올바르게 구현하는 방법을 찾았습니다. 나는 모든 사람들이 그것에 대해 알 수 있도록 나의 소스 코드를 공유 할 것이다. 다시 한 번 감사드립니다 – Sugandika