Boolean values not correctly converted

In an Excel file (link below) all boolean values in column 'SYNONYM' are identified as FALSE by TXlsFile, eventhough a number of cells have TRUE as value. What's wrong with this file?

In similar files TXlsFile works as expected.

and this the code I apply:


                              cellValue := xls.GetCellValue(r, c + 1);
                              if cellValue.IsBoolean then
                                 Species.FieldByName('SYNONYM').AsBoolean := cellValue.AsBoolean
                              else if cellValue.IsString then
                              begin
                                 if (UpperCase(cellValue.AsString) = 'TRUE') or (UpperCase(cellValue.AsString) = 'Y') then
                                    Species.FieldByName('SYNONYM').AsBoolean := True
                                 else
                                    Species.FieldByName('SYNONYM').AsBoolean := False;
                              end

Hi,

I am not sure what can be happening here. I tried your code and it seems to work fine. 
The app I tried is here:
https://download.tmssoftware.com/flexcel/samples/bools.zip

Maybe the file you sent me was re-saved with Excel and Excel fixed it?
Can you try this app with the exact same file where you see the problem there?

Hi Adrian,


thanks for testing. Your code delivers correct results, whereas my code, accessing the same file only delivers FALSE. There must be a stupid mistake in my code, although testing with other Excel files of the same kind procuces correct output.

Hi Adrian,


sorry for having wasted your time. I wasn't aware that the file had two sheets and my tool by default reads the first sheet unless it has a specific name. The second sheet (active one) was created by a customer.
Indeed TxlsFile works as expected. Actually, a always!!!!
Glad to know it worked!
Multiple sheets can indeed sometimes cause confusion, I know this very thing happened to me too...