When i serach to load a file CSV using
var
enc : TEncoding;
xls : TXlsFile;
begin
Result := False;
xls := TXlsFile.Create;
try
enc := TEncoding.UTF8;
try
xls.Open(eFileImport.Text, TFileFormats.TFileFormats_Text, ';', 1, 1, nil, nil, enc, false);
finally
enc.Free;
end;
finally
xls.Free;
end;
i have a message
There is no overloaded version of 'open' that can be called with these arguments
delphi 10.4.1
TMS FlexCell vers.7.6.4
adrian
(adrian)
October 4, 2020, 2:52pm
2
Hi,
FlexCel DLL was made specifically to support Delphi 6 or newer, so we can't use stuff like TEncoding, which was added much later. So, in FlexCel dll you specify the encoding by passing a string from: https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
The other thing is that old delphi versions won't automatically resolve widechars in overloads, so in the text below I used WideChar(';') but that's not needed in Sydney. I just wrote it so people in older versions will be able to use the solution too.
xls.Open('eFileImport.Text', TFileFormats_Text, WideChar(';'), 1, 1, nil, '', 'utf-8', false);
Perfect, il works properly.
Thanks a lot
Angelo