You've already forked lazarus-ccr
fpspreadsheet: Final changes before release 1.6
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4196 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
@ -450,12 +450,13 @@ procedure TForm1.ExportUsingVirtualMode(var DataFileName: string);
|
|||||||
var
|
var
|
||||||
worksheet: TsWorksheet;
|
worksheet: TsWorksheet;
|
||||||
begin
|
begin
|
||||||
|
{
|
||||||
if FILE_FORMATS[RgFileFormat.ItemIndex] = sfOpenDocument then
|
if FILE_FORMATS[RgFileFormat.ItemIndex] = sfOpenDocument then
|
||||||
begin
|
begin
|
||||||
MessageDlg('Virtual mode is not yet implemented for .ods files.', mtError, [mbOK], 0);
|
MessageDlg('Virtual mode is not yet implemented for .ods files.', mtError, [mbOK], 0);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
}
|
||||||
FExportDataset.Open;
|
FExportDataset.Open;
|
||||||
|
|
||||||
FWorkbook := TsWorkbook.Create;
|
FWorkbook := TsWorkbook.Create;
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="fpsspeedtest.pas"/>
|
<Filename Value="fpsspeedtest.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="fpsspeedtest"/>
|
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="mainform.pas"/>
|
<Filename Value="mainform.pas"/>
|
||||||
@ -48,7 +47,6 @@
|
|||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="mainform"/>
|
|
||||||
</Unit1>
|
</Unit1>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
|
@ -2,31 +2,32 @@ object Form1: TForm1
|
|||||||
Left = 445
|
Left = 445
|
||||||
Height = 593
|
Height = 593
|
||||||
Top = 178
|
Top = 178
|
||||||
Width = 764
|
Width = 780
|
||||||
Caption = 'fpsSpeedTest'
|
Caption = 'fpsSpeedTest'
|
||||||
ClientHeight = 593
|
ClientHeight = 593
|
||||||
ClientWidth = 764
|
ClientWidth = 780
|
||||||
KeyPreview = True
|
KeyPreview = True
|
||||||
OnCloseQuery = FormCloseQuery
|
OnCloseQuery = FormCloseQuery
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
OnKeyPress = FormKeyPress
|
OnKeyPress = FormKeyPress
|
||||||
LCLVersion = '1.5'
|
LCLVersion = '1.5'
|
||||||
object StatusBar: TStatusBar
|
object StatusBar: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 570
|
Top = 570
|
||||||
Width = 764
|
Width = 780
|
||||||
Panels = <>
|
Panels = <>
|
||||||
end
|
end
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 52
|
Height = 52
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 764
|
Width = 780
|
||||||
Align = alTop
|
Align = alTop
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 52
|
ClientHeight = 52
|
||||||
ClientWidth = 764
|
ClientWidth = 780
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object BtnWrite: TButton
|
object BtnWrite: TButton
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -41,7 +42,7 @@ object Form1: TForm1
|
|||||||
Left = 184
|
Left = 184
|
||||||
Height = 39
|
Height = 39
|
||||||
Top = 6
|
Top = 6
|
||||||
Width = 576
|
Width = 488
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
Caption = 'Press ESC to cancel when current file is completely written.'#13#10'This may take some time...'
|
Caption = 'Press ESC to cancel when current file is completely written.'#13#10'This may take some time...'
|
||||||
@ -58,6 +59,16 @@ object Form1: TForm1
|
|||||||
OnClick = BtnReadClick
|
OnClick = BtnReadClick
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
|
object BtnSaveResults: TButton
|
||||||
|
Left = 680
|
||||||
|
Height = 29
|
||||||
|
Top = 12
|
||||||
|
Width = 91
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Save results'
|
||||||
|
OnClick = BtnSaveResultsClick
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object ParameterPanel: TPanel
|
object ParameterPanel: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -174,7 +185,7 @@ object Form1: TForm1
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 4
|
Height = 4
|
||||||
Top = 52
|
Top = 52
|
||||||
Width = 764
|
Width = 780
|
||||||
Align = alTop
|
Align = alTop
|
||||||
Shape = bsTopLine
|
Shape = bsTopLine
|
||||||
end
|
end
|
||||||
@ -182,7 +193,7 @@ object Form1: TForm1
|
|||||||
Left = 182
|
Left = 182
|
||||||
Height = 514
|
Height = 514
|
||||||
Top = 56
|
Top = 56
|
||||||
Width = 582
|
Width = 598
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Font.Height = -12
|
Font.Height = -12
|
||||||
Font.Name = 'Courier New'
|
Font.Name = 'Courier New'
|
||||||
@ -191,4 +202,11 @@ object Form1: TForm1
|
|||||||
ScrollBars = ssAutoVertical
|
ScrollBars = ssAutoVertical
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
end
|
end
|
||||||
|
object SaveDialog: TSaveDialog
|
||||||
|
DefaultExt = '.txt'
|
||||||
|
Filter = 'Text files (*.txt)|*.txt|All files (*.*)|*.*'
|
||||||
|
Options = [ofOverwritePrompt, ofPathMustExist, ofEnableSizing, ofViewDetail]
|
||||||
|
left = 708
|
||||||
|
top = 65
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -15,6 +15,7 @@ type
|
|||||||
|
|
||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
Bevel1: TBevel;
|
Bevel1: TBevel;
|
||||||
|
BtnSaveResults: TButton;
|
||||||
BtnWrite: TButton;
|
BtnWrite: TButton;
|
||||||
BtnRead: TButton;
|
BtnRead: TButton;
|
||||||
CgFormats: TCheckGroup;
|
CgFormats: TCheckGroup;
|
||||||
@ -26,17 +27,22 @@ type
|
|||||||
Memo: TMemo;
|
Memo: TMemo;
|
||||||
ParameterPanel: TPanel;
|
ParameterPanel: TPanel;
|
||||||
RgContent: TRadioGroup;
|
RgContent: TRadioGroup;
|
||||||
|
SaveDialog: TSaveDialog;
|
||||||
StatusBar: TStatusBar;
|
StatusBar: TStatusBar;
|
||||||
procedure BtnReadClick(Sender: TObject);
|
procedure BtnReadClick(Sender: TObject);
|
||||||
|
procedure BtnSaveResultsClick(Sender: TObject);
|
||||||
procedure BtnWriteClick(Sender: TObject);
|
procedure BtnWriteClick(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure FormKeyPress(Sender: TObject; var Key: char);
|
procedure FormKeyPress(Sender: TObject; var Key: char);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FDir: String;
|
FDir: String;
|
||||||
FEscape: Boolean;
|
FEscape: Boolean;
|
||||||
FCurFormat: TsSpreadsheetFormat;
|
FCurFormat: TsSpreadsheetFormat;
|
||||||
|
FErrCounter: Integer;
|
||||||
|
FErrLog: TStringList;
|
||||||
procedure EnableControls(AEnable: Boolean);
|
procedure EnableControls(AEnable: Boolean);
|
||||||
function GetRowCount(AIndex: Integer): Integer;
|
function GetRowCount(AIndex: Integer): Integer;
|
||||||
procedure ReadCellDataHandler(Sender: TObject; ARow, ACol: Cardinal;
|
procedure ReadCellDataHandler(Sender: TObject; ARow, ACol: Cardinal;
|
||||||
@ -89,6 +95,13 @@ const
|
|||||||
|
|
||||||
COLCOUNT = 100;
|
COLCOUNT = 100;
|
||||||
|
|
||||||
|
function LeftPad(AText: String; ALength: Integer): String;
|
||||||
|
begin
|
||||||
|
Result := AText;
|
||||||
|
while Length(Result) < ALength do Result := ' ' + Result;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
procedure TForm1.ReadCellDataHandler(Sender: TObject; ARow, ACol: Cardinal;
|
procedure TForm1.ReadCellDataHandler(Sender: TObject; ARow, ACol: Cardinal;
|
||||||
@ -191,12 +204,16 @@ begin
|
|||||||
ok := true;
|
ok := true;
|
||||||
break;
|
break;
|
||||||
except
|
except
|
||||||
|
on E:Exception do begin
|
||||||
|
inc(FErrCounter);
|
||||||
|
FErrLog.Add(Format('[%d] = %s', [FErrCounter, E.Message]));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
MyWorkbook.Free;
|
MyWorkbook.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if not ok then Log := Log + ' xxxx ';
|
if not ok then Log := Log + LeftPad(Format('[%d]',[FErrCounter]),5) + ' ';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
@ -274,8 +291,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
on E: Exception do
|
on E: Exception do begin
|
||||||
Log := Log + format('xxxx ', [(GetTickCount - Tm) / 1000]);
|
inc(FErrCounter);
|
||||||
|
FErrLog.Add(Format('[%d] = %s', [FErrCounter, E.Message]));
|
||||||
|
Log := Log + LeftPad(Format('[%d]',[FErrCounter]),5) + ' ';
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
fname := Trim(Log);
|
fname := Trim(Log);
|
||||||
@ -345,6 +365,7 @@ begin
|
|||||||
|
|
||||||
FEscape := false;
|
FEscape := false;
|
||||||
EnableControls(false);
|
EnableControls(false);
|
||||||
|
FErrLog.Clear;
|
||||||
|
|
||||||
if CbSingleCol.Checked then numCols := 1 else numCols := COLCOUNT;
|
if CbSingleCol.Checked then numCols := 1 else numCols := COLCOUNT;
|
||||||
|
|
||||||
@ -394,6 +415,8 @@ begin
|
|||||||
|
|
||||||
Memo.Append(DupeString('-', len));
|
Memo.Append(DupeString('-', len));
|
||||||
end;
|
end;
|
||||||
|
if FErrLog.Text <> '' then
|
||||||
|
Memo.Append(FErrLog.Text);
|
||||||
Memo.Append('Ready');
|
Memo.Append('Ready');
|
||||||
finally
|
finally
|
||||||
Memo.Append('');
|
Memo.Append('');
|
||||||
@ -401,6 +424,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.BtnSaveResultsClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if SaveDialog.Filename <> '' then
|
||||||
|
SaveDialog.InitialDir := ExtractFileDir(SaveDialog.Filename);
|
||||||
|
if SaveDialog.Execute then
|
||||||
|
Memo.Lines.SaveToFile(SaveDialog.Filename);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.BtnWriteClick(Sender: TObject);
|
procedure TForm1.BtnWriteClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
Rows: integer;
|
Rows: integer;
|
||||||
@ -412,6 +443,7 @@ begin
|
|||||||
|
|
||||||
FEscape := false;
|
FEscape := false;
|
||||||
EnableControls(false);
|
EnableControls(false);
|
||||||
|
FErrLog.Clear;
|
||||||
if CbSingleCol.Checked then numCols := 1 else numCols := COLCOUNT;
|
if CbSingleCol.Checked then numCols := 1 else numCols := COLCOUNT;
|
||||||
|
|
||||||
Memo.Append ('Running: Building TsWorkbook and writing to different file formats');
|
Memo.Append ('Running: Building TsWorkbook and writing to different file formats');
|
||||||
@ -478,6 +510,7 @@ procedure TForm1.EnableControls(AEnable: Boolean);
|
|||||||
begin
|
begin
|
||||||
BtnWrite.Enabled := AEnable;
|
BtnWrite.Enabled := AEnable;
|
||||||
BtnRead.Enabled := AEnable;
|
BtnRead.Enabled := AEnable;
|
||||||
|
BtnSaveResults.Enabled := AEnable;
|
||||||
RgContent.Enabled := AEnable;
|
RgContent.Enabled := AEnable;
|
||||||
CgFormats.Enabled := AEnable;
|
CgFormats.Enabled := AEnable;
|
||||||
CgRowCount.Enabled := AEnable;
|
CgRowCount.Enabled := AEnable;
|
||||||
@ -504,9 +537,16 @@ begin
|
|||||||
CgRowCount.Checked[rc30k] := true;
|
CgRowCount.Checked[rc30k] := true;
|
||||||
CgRowCount.Checked[rc40k] := true;
|
CgRowCount.Checked[rc40k] := true;
|
||||||
|
|
||||||
|
FErrLog := TStringList.Create;
|
||||||
|
|
||||||
ReadFromIni;
|
ReadFromIni;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FErrLog.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
|
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
|
||||||
begin
|
begin
|
||||||
if Key = #27 then begin
|
if Key = #27 then begin
|
||||||
|
@ -83,9 +83,9 @@ object MainForm: TMainForm
|
|||||||
'FileFormat=sfExcel8'
|
'FileFormat=sfExcel8'
|
||||||
'ActiveWorksheet=Sheet1'
|
'ActiveWorksheet=Sheet1'
|
||||||
'Options=boAutoCalc, boCalcBeforeSaving, boReadFormulas'
|
'Options=boAutoCalc, boCalcBeforeSaving, boReadFormulas'
|
||||||
'FormatSettings='
|
'(-) FormatSettings='
|
||||||
' ThousandSeparator=.'
|
' ThousandSeparator=.'
|
||||||
' DecimalSeparator=.'
|
' DecimalSeparator=,'
|
||||||
' ListSeparator=;'
|
' ListSeparator=;'
|
||||||
' DateSeparator=.'
|
' DateSeparator=.'
|
||||||
' TimeSeparator=:'
|
' TimeSeparator=:'
|
||||||
@ -3796,7 +3796,6 @@ object MainForm: TMainForm
|
|||||||
Caption = 'File'
|
Caption = 'File'
|
||||||
object MenuItem50: TMenuItem
|
object MenuItem50: TMenuItem
|
||||||
Action = AcFileOpen
|
Action = AcFileOpen
|
||||||
Caption = '&Open ...x'
|
|
||||||
Bitmap.Data = {
|
Bitmap.Data = {
|
||||||
36040000424D3604000000000000360000002800000010000000100000000100
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
|
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
|
||||||
|
Reference in New Issue
Block a user