My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
WPF CODE EXAMPLE created on Tuesday, July 20, 2010 permalink
Wrapper class to simplify the creation of Excel files in C# 4.0
This class uses of the improved COM Interop in C# 4.0 and makes it simple to create Excel files from data in your application. Note that in your visual studio project you have to add a reference to (in COM tab) the Microsoft Excel 14.0 Object Library.    
using System;
using Microsoft.Office.Interop.Excel;

namespace test_excel
{
    class Program
    {
        static void Main(string[] args)
        {
            ExcelManager em = new ExcelManager(@"c:testreport1234.xlsx");
            em.FillCell(1, 2, "Jan");
            em.FillCell(1, 3, "Feb");
            em.FillCell(1, 4, "Mar");
            em.FillCell(2, 1, "Boston");
            em.FillCell(3, 1, "New York");
            em.Save();
        }
    }

    public class ExcelManager
    {
        Application _excelApp;
        Workbook _wb;
        Worksheet _ws;
        Range _range;
        string _pathAndFileName;

        public ExcelManager(string pathAndFileName, string sheetName = "Data")
        {
            _pathAndFileName = pathAndFileName;
            _excelApp = new Application();
            if (_excelApp == null)
                throw new Exception("excel sheet could not be created, check your office installation");
            //_excelApp.Visible = true; //uncomment to see it being created
            _wb = _excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
            _ws = (Worksheet)_wb.Worksheets[1];
            if (_ws == null)
                throw new Exception("workshop could not be craeted, check your office installation");
            _ws.Name = sheetName;
            _range = _ws.UsedRange;
        }

        public void FillCell(int row, int column, string value)
        {
            _ws.Cells[row, column] = value;
        }

        public void Save()
        {
            _wb.SaveAs(_pathAndFileName);
            _wb.Close();
        }
    }
}
need markup?