I’m converting some VBA into C# with closedXML. Also teaching me to learn it as I go along. It was all going sweet up until now.
I’m getting values from the source and then concatenate them to from a string for the destination. For every column that isn’t merged it works great. Just this column that has the merged cells
This code is to string the valueV and get the value. I’ve tried to change this to column but it won’t have it.
string valueV = srcSheet.Cell(i, 22).GetValue<string>();
This is the code that determines what the value should be. I know this is returnig as empty as when it loops, the valueV is empty.
string animalValue = valueV.Contains("cat") ? "CAT" : valueV.Contains("dog") ? "DOG" : string.Empty;
I’ve tried else and if, switch statements. No matter what I do, it always ends in the same result. I’m sure it’s to do with the 1st code as this is getting the valueV from the start. If it returns null then the other code won’t work as it will return nill also.
The is the merged src column
1 ["This is my cat"] 2 [""] 3 [""] 4 [""] 5 ["This is my dog"] 6 [""] 7 [""]
So when it adds to the destination sheet, it will look like this as it loops
1 ["CAT"] 2 ["CAT"] 3 ["CAT"] 4 ["CAT"] 5 ["DOG"] 6 ["DOG"] 7 ["DOG"]