You've already forked lazarus-ccr
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:
@ -44,34 +44,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if not FileExists(InputFileName) then begin
|
if FileExists(InputFileName) then
|
||||||
WriteLn('Input file ', InputFileName, ' does not exist. Please run opendocwrite first.');
|
begin
|
||||||
Halt;
|
WriteLn('Opening input file ', InputFilename);
|
||||||
end;
|
|
||||||
WriteLn('Opening input file ', InputFilename);
|
|
||||||
|
|
||||||
// Create the spreadsheet
|
// Create the spreadsheet
|
||||||
MyWorkbook := TsWorkbook.Create;
|
MyWorkbook := TsWorkbook.Create;
|
||||||
|
MyWorkbook.Options := MyWorkbook.Options + [boReadFormulas];
|
||||||
|
try
|
||||||
|
try
|
||||||
|
MyWorkbook.ReadFromFile(InputFilename, sfidOOXML_crypto, password);
|
||||||
|
|
||||||
MyWorkbook.Options := MyWorkbook.Options + [boReadFormulas];
|
MyWorksheet := MyWorkbook.GetFirstWorksheet;
|
||||||
MyWorkbook.ReadFromFile(InputFilename, sfidOOXML_crypto, password);
|
|
||||||
|
|
||||||
MyWorksheet := MyWorkbook.GetFirstWorksheet;
|
// Write all cells with contents to the console
|
||||||
|
WriteLn('');
|
||||||
|
WriteLn('Contents of the first worksheet of the file:');
|
||||||
|
WriteLn('');
|
||||||
|
|
||||||
// Write all cells with contents to the console
|
for cell in MyWorksheet.Cells do
|
||||||
WriteLn('');
|
WriteLn(
|
||||||
WriteLn('Contents of the first worksheet of the file:');
|
'Row: ', cell^.Row,
|
||||||
WriteLn('');
|
' Col: ', cell^.Col,
|
||||||
|
' Value: ', UTF8ToConsole(MyWorkSheet.ReadAsText(cell^.Row, cell^.Col))
|
||||||
|
);
|
||||||
|
except
|
||||||
|
WriteLn('Error opening file ', InputFileName);
|
||||||
|
end;
|
||||||
|
|
||||||
for cell in MyWorksheet.Cells do
|
finally
|
||||||
WriteLn(
|
// Finalization
|
||||||
'Row: ', cell^.Row,
|
MyWorkbook.Free;
|
||||||
' Col: ', cell^.Col,
|
end;
|
||||||
' Value: ', UTF8ToConsole(MyWorkSheet.ReadAsText(cell^.Row, cell^.Col))
|
end
|
||||||
);
|
else
|
||||||
|
WriteLn('Input file ', InputFileName, ' does not exist.');
|
||||||
// Finalization
|
|
||||||
MyWorkbook.Free;
|
|
||||||
|
|
||||||
if ParamCount = 0 then
|
if ParamCount = 0 then
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user