fpspreadsheet: minor refactoring of crypto example.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8199 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-02-18 18:17:14 +00:00
parent 074605a212
commit 00dfa0a45e

View File

@ -44,16 +44,15 @@ begin
end;
end;
if not FileExists(InputFileName) then begin
WriteLn('Input file ', InputFileName, ' does not exist. Please run opendocwrite first.');
Halt;
end;
if FileExists(InputFileName) then
begin
WriteLn('Opening input file ', InputFilename);
// Create the spreadsheet
MyWorkbook := TsWorkbook.Create;
MyWorkbook.Options := MyWorkbook.Options + [boReadFormulas];
try
try
MyWorkbook.ReadFromFile(InputFilename, sfidOOXML_crypto, password);
MyWorksheet := MyWorkbook.GetFirstWorksheet;
@ -69,9 +68,17 @@ begin
' Col: ', cell^.Col,
' Value: ', UTF8ToConsole(MyWorkSheet.ReadAsText(cell^.Row, cell^.Col))
);
except
WriteLn('Error opening file ', InputFileName);
end;
finally
// Finalization
MyWorkbook.Free;
end;
end
else
WriteLn('Input file ', InputFileName, ' does not exist.');
if ParamCount = 0 then
begin