title: How to download Excel object in ASP.Net
body: <p>Please consider this code:</p>
  
  <pre><code>Microsoft.Office.Interop.Excel.Application objApp;
      Microsoft.Office.Interop.Excel._Workbook objBook;
      Microsoft.Office.Interop.Excel.Workbooks objBooks;
      Microsoft.Office.Interop.Excel.Sheets objSheets;
      Microsoft.Office.Interop.Excel._Worksheet objSheet;
      Microsoft.Office.Interop.Excel.Range range;
  
      int ColumnsCount = dt.Columns.Count;
      int RowsCount = dt.Rows.Count;
  
      objApp = new Microsoft.Office.Interop.Excel.Application();
      objBooks = objApp.Workbooks;
      objBook = objBooks.Add(System.Reflection.Missing.Value);
      objSheets = objBook.Worksheets;
      objSheet = (Microsoft.Office.Interop.Excel._Worksheet)objSheets.get_Item(1);
  
      for (int i = 1; i &lt; ColumnsCount + 1; i++)
      {
          objSheet.Cells[1, i] = dt.Columns[i - 1].ColumnName;
      }
  
      range = objSheet.get_Range("A2", System.Reflection.Missing.Value);
      range = range.get_Resize(RowsCount, ColumnsCount);
  
      string[,] saRet = new string[RowsCount, ColumnsCount];
  
      for (int iRow = 0; iRow &lt; RowsCount; iRow++)
      {
          for (int iCol = 0; iCol &lt; ColumnsCount; iCol++)
          {
              saRet[iRow, iCol] = dt.Rows[iRow][iCol].ToString();
          }
      }
  
      //Set the range value to the array.
      range.set_Value(Missing.Value, saRet);
  </code></pre>
  
  <p>I want to download Excel object that I created. The problem is <code>Microsoft.Office.Interop.Excel._Workbook</code> is not serializable and until I save it I can't access Excel file. How I can download Excel that created in memory?</p>
  
  <p>thanks</p>