title: Excel XML Spreadsheet CSHTML
body: <p>I want to create a graph in Excel with the spreadsheet reference.</p>
  
  <pre><code>@model IEnumerable&lt;ARTex.Core.Models.Reservation&gt;
  
  @{
      Layout = null;
      Response.ContentType = "application/vnd.ms-excel";
      Response.AddHeader("Content-Disposition", "attachment; filename= Reservaties - " + DateTime.Now.ToString("dd/MM/yyyy") + ".xls");
  
  }
  
      &lt;?xml version="1.0" encoding="utf-16"?&gt;
  
  &lt;ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"&gt;
  &lt;ss:Styles&gt;
          &lt;!--style reservation header--&gt;
          &lt;ss:Style ss:ID="1"&gt;
              &lt;ss:Font ss:Bold="1" ss:Size="11" ss:Color="White"/&gt;
              &lt;ss:Interior ss:Color='Black'  ss:Pattern='Solid'/&gt;
          &lt;/ss:Style&gt;
          &lt;!--style group/individual header--&gt;
          &lt;ss:Style ss:ID="2"&gt;
              &lt;ss:Font ss:Bold="1" ss:Size="11"/&gt;
              &lt;ss:Interior ss:Color='#D9D9D9' ss:Pattern='Solid'/&gt;
          &lt;/ss:Style&gt;
          &lt;!--style group/individual/reservation body--&gt;
          &lt;ss:Style ss:ID="3"&gt;
              &lt;ss:Interior ss:Pattern='Solid' /&gt;
              &lt;ss:Alignment ss:WrapText="1" ss:Vertical="Top"/&gt;
          &lt;/ss:Style&gt;
          &lt;ss:Style ss:ID="4"&gt;
              &lt;ss:Interior ss:Pattern='Solid'/&gt;
          &lt;/ss:Style&gt;
  &lt;/ss:Styles&gt;
  
  @{Html.RenderPartial("_ExcelWorksheet", Model.Where(x =&gt; !x.Deleted), new ViewDataDictionary { { "sheetName", "Reservations" } });
    Html.RenderPartial("_ExcelWorksheet", Model.Where(x =&gt; x.Deleted), new ViewDataDictionary { { "sheetName", "Deleted Reservations" } });
    Html.RenderPartial("_ExcelGraph", Model,new ViewDataDictionary{ {"sheetname", "Graph" }});}}
  
  
  
  
  &lt;/ss:Workbook&gt;
  </code></pre>
  
  <p>this is my main .cshtml page and I want to create a graph with the Partial view page _ExcelGraph. I'm just trying to show the some basic output.</p>
  
  <p>Code _ExcelGraph</p>
  
  <pre><code>@{ 
  
      var myChart = new Chart(width: 600, height: 400) 
          .AddTitle("Chart Title") 
          .AddSeries( 
              name: "Employee", 
              xValue: new[] {  "Peter", "Andrew", "Julie", "Mary", "Dave" }, 
              yValues: new[] { "2", "6", "4", "5", "3" }) 
          .Write(); 
  }
  </code></pre>
  
  <p>This keeps giving me an image and I can't seem to figure out how to place this image in a worksheet or how I can properly show it as a worksheet.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Read somewhere that this ain't possible with XML spreadsheet reference 2003 ?</p>