You've already forked lazarus-ccr
fpspreadsheet: String typo fixed and adds a new convinience routine to the grid code
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1682 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,15 +1,10 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="7"/>
|
<Version Value="9"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
|
||||||
<AlwaysBuild Value="False"/>
|
|
||||||
<UseDefaultCompilerOptions Value="True"/>
|
|
||||||
</Flags>
|
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<TargetFileExt Value=""/>
|
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<Icon Value="0"/>
|
<Icon Value="0"/>
|
||||||
@ -17,8 +12,11 @@
|
|||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
<Language Value=""/>
|
<Language Value=""/>
|
||||||
<CharSet Value=""/>
|
<CharSet Value=""/>
|
||||||
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
|
<StringTable ProductVersion=""/>
|
||||||
</VersionInfo>
|
</VersionInfo>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
<IgnoreBinaries Value="False"/>
|
<IgnoreBinaries Value="False"/>
|
||||||
@ -59,19 +57,14 @@
|
|||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="10"/>
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="fpschart"/>
|
<Filename Value="fpschart"/>
|
||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="$(ProjOutDir)/"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
|
||||||
<SyntaxOptions>
|
|
||||||
<UseAnsiStrings Value="True"/>
|
|
||||||
</SyntaxOptions>
|
|
||||||
</Parsing>
|
|
||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<GenerateDebugInfo Value="True"/>
|
<GenerateDebugInfo Value="True"/>
|
||||||
|
@ -7,7 +7,7 @@ object FPSChartForm: TFPSChartForm
|
|||||||
ClientHeight = 382
|
ClientHeight = 382
|
||||||
ClientWidth = 700
|
ClientWidth = 700
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '0.9.31'
|
||||||
object MyChart: TChart
|
object MyChart: TChart
|
||||||
Left = 352
|
Left = 352
|
||||||
Height = 240
|
Height = 240
|
||||||
@ -15,8 +15,7 @@ object FPSChartForm: TFPSChartForm
|
|||||||
Width = 336
|
Width = 336
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Alignment = calLeft
|
Title.LabelFont.Orientation = 900
|
||||||
Title.Font.Orientation = 900
|
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Alignment = calBottom
|
Alignment = calBottom
|
||||||
@ -31,7 +30,6 @@ object FPSChartForm: TFPSChartForm
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
object MyChartLineSeries: TLineSeries
|
object MyChartLineSeries: TLineSeries
|
||||||
LinePen.Color = clRed
|
LinePen.Color = clRed
|
||||||
SeriesColor = clRed
|
|
||||||
Source = FPSChartSource
|
Source = FPSChartSource
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -64,7 +62,7 @@ object FPSChartForm: TFPSChartForm
|
|||||||
end
|
end
|
||||||
object editSourceFile: TFileNameEdit
|
object editSourceFile: TFileNameEdit
|
||||||
Left = 152
|
Left = 152
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 48
|
Top = 48
|
||||||
Width = 136
|
Width = 136
|
||||||
DialogOptions = []
|
DialogOptions = []
|
||||||
@ -79,7 +77,7 @@ object FPSChartForm: TFPSChartForm
|
|||||||
Left = 14
|
Left = 14
|
||||||
Height = 18
|
Height = 18
|
||||||
Top = 51
|
Top = 51
|
||||||
Width = 130
|
Width = 136
|
||||||
Caption = 'Source Spreadsheet:'
|
Caption = 'Source Spreadsheet:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -94,7 +92,7 @@ object FPSChartForm: TFPSChartForm
|
|||||||
end
|
end
|
||||||
object editXAxis: TLabeledEdit
|
object editXAxis: TLabeledEdit
|
||||||
Left = 64
|
Left = 64
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 80
|
Top = 80
|
||||||
Width = 80
|
Width = 80
|
||||||
EditLabel.AnchorSideLeft.Control = editXAxis
|
EditLabel.AnchorSideLeft.Control = editXAxis
|
||||||
@ -102,10 +100,10 @@ object FPSChartForm: TFPSChartForm
|
|||||||
EditLabel.AnchorSideTop.Side = asrCenter
|
EditLabel.AnchorSideTop.Side = asrCenter
|
||||||
EditLabel.AnchorSideRight.Control = editXAxis
|
EditLabel.AnchorSideRight.Control = editXAxis
|
||||||
EditLabel.AnchorSideBottom.Control = editXAxis
|
EditLabel.AnchorSideBottom.Control = editXAxis
|
||||||
EditLabel.Left = 17
|
EditLabel.Left = 18
|
||||||
EditLabel.Height = 18
|
EditLabel.Height = 18
|
||||||
EditLabel.Top = 82
|
EditLabel.Top = 83
|
||||||
EditLabel.Width = 44
|
EditLabel.Width = 43
|
||||||
EditLabel.Caption = 'X-Axis:'
|
EditLabel.Caption = 'X-Axis:'
|
||||||
EditLabel.ParentColor = False
|
EditLabel.ParentColor = False
|
||||||
LabelPosition = lpLeft
|
LabelPosition = lpLeft
|
||||||
@ -114,7 +112,7 @@ object FPSChartForm: TFPSChartForm
|
|||||||
end
|
end
|
||||||
object EditYAxis: TLabeledEdit
|
object EditYAxis: TLabeledEdit
|
||||||
Left = 208
|
Left = 208
|
||||||
Height = 22
|
Height = 25
|
||||||
Top = 80
|
Top = 80
|
||||||
Width = 80
|
Width = 80
|
||||||
EditLabel.AnchorSideLeft.Control = EditYAxis
|
EditLabel.AnchorSideLeft.Control = EditYAxis
|
||||||
@ -122,10 +120,10 @@ object FPSChartForm: TFPSChartForm
|
|||||||
EditLabel.AnchorSideTop.Side = asrCenter
|
EditLabel.AnchorSideTop.Side = asrCenter
|
||||||
EditLabel.AnchorSideRight.Control = EditYAxis
|
EditLabel.AnchorSideRight.Control = EditYAxis
|
||||||
EditLabel.AnchorSideBottom.Control = EditYAxis
|
EditLabel.AnchorSideBottom.Control = EditYAxis
|
||||||
EditLabel.Left = 161
|
EditLabel.Left = 164
|
||||||
EditLabel.Height = 18
|
EditLabel.Height = 18
|
||||||
EditLabel.Top = 82
|
EditLabel.Top = 83
|
||||||
EditLabel.Width = 44
|
EditLabel.Width = 41
|
||||||
EditLabel.Caption = 'Y-Axis:'
|
EditLabel.Caption = 'Y-Axis:'
|
||||||
EditLabel.ParentColor = False
|
EditLabel.ParentColor = False
|
||||||
LabelPosition = lpLeft
|
LabelPosition = lpLeft
|
||||||
|
@ -54,19 +54,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPSChartForm.btnLoadSpreadsheetClick(Sender: TObject);
|
procedure TFPSChartForm.btnLoadSpreadsheetClick(Sender: TObject);
|
||||||
var
|
|
||||||
Format: TsSpreadsheetFormat;
|
|
||||||
lExt: string;
|
|
||||||
begin
|
begin
|
||||||
// First some logic to detect the format from the extension
|
WorksheetGrid.LoadFromSpreadsheetFile(editSourceFile.Text);
|
||||||
lExt := ExtractFileExt(editSourceFile.Text);
|
|
||||||
if lExt = STR_EXCEL_EXTENSION then Format := sfExcel2
|
|
||||||
else if lExt = STR_OOXML_EXCEL_EXTENSION then Format := sfOOXML
|
|
||||||
else if lExt = STR_OPENDOCUMENT_CALC_EXTENSION then Format := sfOpenDocument
|
|
||||||
else raise Exception.Create('Invalid File Extension');
|
|
||||||
|
|
||||||
// Now the actual loading
|
|
||||||
WorksheetGrid.LoadFromSpreadsheetFile(editSourceFile.Text, Format);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPSChartForm.FormCreate(Sender: TObject);
|
procedure TFPSChartForm.FormCreate(Sender: TObject);
|
||||||
|
@ -10,7 +10,8 @@ program test_write_formula;
|
|||||||
{$mode delphi}{$H+}
|
{$mode delphi}{$H+}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, fpspreadsheet, xlsbiff8, fpsopendocument,
|
Classes, SysUtils,
|
||||||
|
fpspreadsheet, xlsbiff5, xlsbiff8, fpsopendocument,
|
||||||
laz_fpspreadsheet, fpsconvencoding;
|
laz_fpspreadsheet, fpsconvencoding;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -751,8 +751,8 @@ begin
|
|||||||
FWorksheets := TFPList.Create;
|
FWorksheets := TFPList.Create;
|
||||||
|
|
||||||
// In the future: add support for translations
|
// In the future: add support for translations
|
||||||
lpUnsupportedReadFormat := 'Tryed to read a spreadsheet using an unsupported format';
|
lpUnsupportedReadFormat := 'Tried to read a spreadsheet using an unsupported format';
|
||||||
lpUnsupportedWriteFormat := 'Tryed to write a spreadsheet using an unsupported format';
|
lpUnsupportedWriteFormat := 'Tried to write a spreadsheet using an unsupported format';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@
|
{@@
|
||||||
|
@ -31,7 +31,8 @@ type
|
|||||||
{ methods }
|
{ methods }
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure LoadFromWorksheet(AWorksheet: TsWorksheet);
|
procedure LoadFromWorksheet(AWorksheet: TsWorksheet);
|
||||||
procedure LoadFromSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = 0);
|
procedure LoadFromSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = 0); overload;
|
||||||
|
procedure LoadFromSpreadsheetFile(AFileName: string; AWorksheetIndex: Integer = 0); overload;
|
||||||
procedure SaveToWorksheet(AWorksheet: TsWorksheet);
|
procedure SaveToWorksheet(AWorksheet: TsWorksheet);
|
||||||
property DisplayFixedColRow: Boolean read FDisplayFixedColRow write SetDisplayFixedColRow;
|
property DisplayFixedColRow: Boolean read FDisplayFixedColRow write SetDisplayFixedColRow;
|
||||||
end;
|
end;
|
||||||
@ -236,6 +237,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string;
|
||||||
|
AWorksheetIndex: Integer);
|
||||||
|
var
|
||||||
|
lWorkbook: TsWorkbook;
|
||||||
|
begin
|
||||||
|
lWorkbook := TsWorkbook.Create;
|
||||||
|
try
|
||||||
|
lWorkbook.ReadFromFile(AFileName);
|
||||||
|
LoadFromWorksheet(lWorkbook.GetWorksheetByIndex(AWorksheetIndex));
|
||||||
|
finally
|
||||||
|
lWorkbook.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SaveToWorksheet(AWorksheet: TsWorksheet);
|
procedure TsCustomWorksheetGrid.SaveToWorksheet(AWorksheet: TsWorksheet);
|
||||||
var
|
var
|
||||||
x, y: Integer;
|
x, y: Integer;
|
||||||
|
Reference in New Issue
Block a user