TsWorksheetGrid.LoadFromSpreadsheetFile overloaded problem [SOLVED] lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- totya · 2016-09-25 18:41 Hi! TsWorksheetGrid Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Grid.LoadFromSpreadsheetFile(UTF8ToAnsi(AFileName)); It's working. But: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Grid.LoadFromSpreadsheetFile(UTF8ToAnsi(AFileName), 0); doesn't work, the compiler say: QuoteError: Can't determine which overloaded function to call LOL. This method available in fpspreadsheetgrid: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure LoadFromSpreadsheetFile(AFileName: string; AWorksheetIndex: Integer = -1); overload; What's wrong here? Thanks! ---------------------------------------------------------------------- wp · 2016-09-25 20:32 OMG! Too many overloads from ancient times... The problem occurs because TsSpreadFormatID is just an alias for an integer, and thus the compiler cannot distinguish whether the second parameters means the file format id or the worksheet index. I removed one of the overloads, and LoadFromSpreadsheetFile works now with all parameter counts. But note that the overload specifying only the sheet index but not the (user-defined) format is no longer available now. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     procedure LoadFromSpreadsheetFile(AFileName: string;      AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = -1); overload;     procedure LoadFromSpreadsheetFile(AFileName: string;      AFormatID: TsSpreadFormatID = sfidUnknown;      AWorksheetIndex: Integer = -1); overload; ---------------------------------------------------------------------- totya · 2016-09-25 20:44 Hi! Now, if I want to open one worksheet, and I don't know what is the type of the file, this format needed: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Grid.LoadFromSpreadsheetFile(UTF8ToAnsi(AFileName), sfidUnknown, WSNum); Thanks! ---------------------------------------------------------------------- wp · 2016-09-25 21:08 Yes. What if I add a LoadSheetFromFile(AFileName, ASheetIndex: Integer -1; AFormatID: Integer = sfidUnknow)? Then you could call LoadFromSpreadsheetFile(AFileName), or LoadSheetFromFile(AFileName) -- for active sheet and automatic format detectionLoadSheetFromFile(AFilename, ASheetIndex) -- for specified sheet and automatic format detectionLoadSheetFromFile(AFilename, ASheetIndex, AFormatID) -- for specified sheet and specified format     the same with LoadFromSpreadsheetFile(AFileName, AFormatID)LoadFromSpreadsheetFile(AFileName, AFormatID) -- for specified format and active sheet ---------------------------------------------------------------------- totya · 2016-09-25 21:20 That's a good idea, works similar as the last deleted method... ---------------------------------------------------------------------- wp · 2016-09-25 21:37 It's in r5212. I just renamed it to LoadSheetFromSpreadsheetFile (to be more consistent with the others). ---------------------------------------------------------------------- totya · 2016-09-25 22:25 Quote from: wp on September 25, 2016, 11:37:34 pmIt's in r5212. I just renamed it to LoadSheetFromSpreadsheetFile (to be more consistent with the others). Thanks, its working (after few recompile, my app see this new method).