Search code examples
c#epplusstrikethrough

How to apply strike formatting using EPPlus


I'm using EPPlus in a web application with C#. I need to read an Excel file and check its format, I tried it doing the same as this article (How do I get partial cell styling in excel using EPpplus?), and actually all format properties were ok (bold, italic, color...), but the one that I really need is to check the strike text property and it is always set to false.


Solution

  • Here is an answer just so the question doesnt hang out there:

    [TestMethod]
    public void Strike_Format_Test()
    {
        //http://stackoverflow.com/questions/30517646/how-to-apply-strike-formatting-using-epplus
    
        var existingFile = new FileInfo(@"c:\temp\StrikeFormat.xlsx");
        using (var pck = new ExcelPackage(existingFile))
        {
            var wb = pck.Workbook;
            var ws = wb.Worksheets.First();
    
            var cell = ws.Cells["A1"];
            Console.WriteLine(cell.Style.Font.Strike);
        }
    }