Search code examples
c#excelnpoi

NPOI C# SetCellValue() of bool type via variable as string


I want to SetCellValue() of bool type via variable as string for example:

string parameter = "TRUE";

and now I want to SetCellValue(parameter)

What is the correct way to set the cell value as boolean type from the string value above?

Thansk very much in advance


Solution

  • You can use bool.Parse(string value)

    string parameter = "TRUE";
    
    SetCellValue(bool.Parse(parameter));