0

enter image description here

There are 2 checkboxes, check box 6 - YES and check box 7 - NO. How do I get their checked or unchecked state using EPPlus package.. I have tried this, but in vain..

var package = new ExcelPackage(@”C:\file.xlsm”);
var worksheets = package.Workbook.Worksheets;
ExcelWorksheet sheet1 = worksheets.Where(m => m.Name.ToUpper().Contains("sheet1")).SingleOrDefault();

if (sheet1 != null)
{
    var pia = sheet.Cells["C4"].Text.Trim();
    ExcelDrawing checkbox6 = cableWorkOrder.Drawings.SingleOrDefault(a => a.Name == "Check Box 6");
   
    // How to read if check box 6 is checked or not..what is the correct way of doing this? 
}
Maciej Los
  • 8,468
  • 1
  • 20
  • 35
  • Why do you use 2 checkboxes for simple [Y/N] (checked/unchecked) status? – Maciej Los Jul 22 '21 at 08:59
  • @MaciejLos.. thank you.. very kind of you.. cheers – Yadu Mandayam Jul 22 '21 at 09:00
  • Does it help: [How to read the state of a checkbox in an excel file with EPPlus ( C# )](https://stackoverflow.com/questions/39095874/how-to-read-the-state-of-a-checkbox-in-an-excel-file-with-epplus-c-sharp) – Maciej Los Jul 22 '21 at 09:04
  • Sorry I have no control over it, i just use it as its given.. cheers and I saw the above link, and am looking for a way, without cell linking? – Yadu Mandayam Jul 22 '21 at 09:06
  • You may be out of luck with EEPluss if the Excel file uses a “WindowsCheckBox” Control. My understanding is that EPPLus does not support access to the Win control(s) on a worksheet. Looking at the picture does not tell us “how” the check box was created. So it is a guess as to “how” to access it. As already noted by the previous link, the windows check box control in the worksheet has a property which will allow the control to report its value to a particular cell. If that property is set, THEN yes EPPLus should be able to get the value as long as you know which cell it is in. – JohnG Jul 22 '21 at 09:45

0 Answers0