You've already forked lazarus-ccr
fpspreadsheet: Use a local variable for found worksheet in search_demo (https://forum.lazarus.freepascal.org/index.php/topic,50851.msg372259).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7595 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<CompatibilityMode Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="demo_search"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
@ -57,7 +57,7 @@
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
|
@ -14,7 +14,8 @@ var
|
||||
worksheet: TsWorksheet;
|
||||
s: String;
|
||||
searchParams: TsSearchParams;
|
||||
RowFound, ColFound: Cardinal;
|
||||
rowFound, colFound: Cardinal;
|
||||
worksheetFound: TsWorksheet;
|
||||
|
||||
begin
|
||||
workbook := TsWorkbook.Create;
|
||||
@ -36,10 +37,12 @@ begin
|
||||
|
||||
// Create search engine and execute search
|
||||
with TsSearchEngine.Create(workbook) do begin
|
||||
if FindFirst(searchParams, worksheet, RowFound, ColFound) then begin
|
||||
WriteLn('First "', searchparams.SearchText, '" found in cell ', GetCellString(RowFound, ColFound));
|
||||
while FindNext(searchParams, worksheet, RowFound, ColFound) do
|
||||
WriteLn('Next "', searchParams.SearchText, '" found in cell ', GetCellString(RowFound, ColFound));
|
||||
if FindFirst(searchParams, worksheetFound, rowFound, colFound) then begin
|
||||
WriteLn('First "', searchparams.SearchText, '" found in cell ',
|
||||
GetCellString(rowFound, colFound), ' of worksheet ', worksheetFound.Name);
|
||||
while FindNext(searchParams, worksheetFound, rowFound, colFound) do
|
||||
WriteLn('Next "', searchParams.SearchText, '" found in cell ',
|
||||
GetCellString(rowFound, colFound), ' of worksheet ', worksheetFound.Name);
|
||||
end;
|
||||
Free;
|
||||
end;
|
||||
@ -47,18 +50,24 @@ begin
|
||||
// Now search in comments
|
||||
Include(searchparams.Options, soSearchInComment);
|
||||
with TsSearchEngine.Create(workbook) do begin
|
||||
if FindFirst(searchParams, worksheet, RowFound, ColFound) then begin
|
||||
WriteLn('First "', searchparams.SearchText, '" found in comment of cell ', GetCellString(RowFound, ColFound));
|
||||
while FindNext(searchParams, worksheet, RowFound, ColFound) do
|
||||
WriteLn('Next "', searchParams.SearchText, '" found in comment of cell ', GetCellString(RowFound, ColFound));
|
||||
if FindFirst(searchParams, worksheetFound, rowFound, colFound) then begin
|
||||
WriteLn('First "', searchparams.SearchText, '" found in comment of cell ',
|
||||
GetCellString(rowFound, colFound), ' of worksheet ', worksheetFound.Name);
|
||||
while FindNext(searchParams, worksheetFound, rowFound, colFound) do
|
||||
WriteLn('Next "', searchParams.SearchText, '" found in comment of cell ',
|
||||
GetCellString(rowFound, colFound), ' of worksheet ', worksheetFound.Name);
|
||||
end;
|
||||
Free;
|
||||
end;
|
||||
|
||||
ReadLn;
|
||||
|
||||
finally
|
||||
workbook.Free;
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
WriteLn;
|
||||
WriteLn('Press ENTER to quit...');
|
||||
ReadLn;
|
||||
{$ENDIF}
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user