Excel-DNA / Excel-DNA/ExcelDna

Custom `string` to `bool` conversion

Open
#818 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.5k
Forks
292
Avg merge
20d 12h
Merged PRs (30d)
1

Description

Is it possible to register a custom `string` to `bool` conversion?

```
[ExcelParameterConversion]
public static bool? StringToBool(string? value)
{
value = value?.ToLowerInvariant();
return value switch
{
"true" => true,
_ => false,
};
}
```
I tried above with `bool?` and `string?` (4 combinations) but all of them fail with `#VALUE`

The request may come weird but I am working on drop down support for intellisense and for bool types when user types `TRUE` exceltooltip window also pops up. I couldnt find a way to properly handle it and I think I shouldnt handle it so I was trying to fill the value as `"TRUE"` so exceltooltip wouldnt pop and tab completion etc would work better

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.