This project has moved. For the latest updates, please go here.

Can't Change Value of a Cell

Feb 1, 2015 at 11:04 AM
Hi guys,
I am trying to study EPPlus library. I am trying to change value of a cell but it doesn't work. I don't know why. I open the file correctly, no error reports appear, but when I close the program nothing is changed into the file. Here is my code"

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using OfficeOpenXml;

class Program
{
static void Main()
{
    var ExistFile = "file.xlsx";
    var File = new FileInfo(ExistFile);

    using (ExcelPackage package = new ExcelPackage(File))
    {            
        ExcelWorkbook workBook = package.Workbook;
        ExcelWorksheet cSheet = workBook.Worksheets.First();
        cSheet.Cells[15, 5].Value = 1;
        package.Save();            
    }
}
}