Search code examples
epplus

EPPlus how to write actual 'true' value


Using EPPlus, how can I write the actual excel TRUE value to a cell? I'm just getting the text value, and I have to explicitly click into the cell and press enter to have it recognize it as a boolean.


Solution

  • Cell.Value is an object so if you set it as a bool it will box it and preserve the type:

    var cells = worksheet.Cells;
    cells["A1"].Value = false;   // not = "false"
    cells["A2"].Value = true;    // not = "true"
    

    Which will give you this:

    enter image description here