fpspreadsheet: Add property UsesBuiltinWorkbook to TsWorkbookSource for not overwriting some grid-specific settings when a new workbook is created. https://forum.lazarus.freepascal.org/index.php/topic,69126.msg536779

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9496 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-11-04 11:02:09 +00:00
parent 873d0f4a91
commit 188553b343
2 changed files with 9 additions and 1 deletions

View File

@ -70,6 +70,7 @@ type
FPendingSelection: TsCellRangeArray;
FPendingOperation: TsCopyOperation;
FOptions: TsWorkbookOptions;
FUsesBuiltinWorkbook: Boolean;
FOnError: TsWorkbookSourceErrorEvent;
FOnQueryPassword: TsOnQueryPassword;
@ -161,6 +162,8 @@ type
care of user-defined formats. }
property FileFormatID: TsSpreadFormatID read FFileFormatID write SetFileFormatID;
property UsesBuiltinWorkbook: Boolean read FUsesBuiltinWorkbook;
published
{@@ Automatically detects the fileformat when loading the spreadsheet file
specified by FileName }
@ -872,6 +875,7 @@ begin
FListeners := TFPList.Create;
FFileFormatID := ord(sfOOXML);
FAutoDetectFormat := True;
FUsesBuiltinWorkbook := true;
CreateNewWorkbook;
end;
@ -1166,7 +1170,7 @@ begin
book.Options := FOptions;
book.OnQueryPassword := @DoQueryPassword;
if AAutoDetect then
book.ReadfromFile(AFileName, APassword)
book.ReadFromFile(AFileName, APassword)
else
book.ReadFromFile(AFileName, AFormatID, APassword);
InternalLoadFromWorkbook(book, AWorksheetIndex);
@ -1197,6 +1201,8 @@ begin
end;
SelectWorksheet(FWorkbook.GetWorksheetByIndex(AWorksheetIndex));
FUsesBuiltinWorkbook := false;
AWorkbook.EnableNotifications;
// If required, display loading error message

View File

@ -4897,6 +4897,8 @@ var
begin
Unused(AData);
if WorkbookSource.UsesBuiltinWorkbook then
exit;
{$IFDEF GRID_DEBUG}
if Worksheet <> nil then