lazspreadsheet: Fix for current version of fpspreadsheet

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5267 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-10-18 21:47:38 +00:00
parent 64c7ebd6f3
commit f2907e713c
4 changed files with 19 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="9"/>
@@ -12,9 +12,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>
@@ -41,7 +38,6 @@
<Unit0> <Unit0>
<Filename Value="lazspreadsheet.lpr"/> <Filename Value="lazspreadsheet.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="lazspreadsheet"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="about.pas"/> <Filename Value="about.pas"/>
@@ -49,7 +45,6 @@
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="about"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="mainform.pas"/> <Filename Value="mainform.pas"/>
@@ -57,7 +52,6 @@
<ComponentName Value="lazfpsmainform"/> <ComponentName Value="lazfpsmainform"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="mainform"/>
</Unit2> </Unit2>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@@ -77,12 +71,6 @@
</Win32> </Win32>
</Options> </Options>
</Linking> </Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions> </CompilerOptions>
<Debugging> <Debugging>
<Exceptions Count="3"> <Exceptions Count="3">

View File

@@ -8,7 +8,7 @@ object lazfpsmainform: Tlazfpsmainform
ClientWidth = 700 ClientWidth = 700
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
LCLVersion = '1.1' LCLVersion = '1.7'
object pagesSheets: TPageControl object pagesSheets: TPageControl
Left = 0 Left = 0
Height = 289 Height = 289
@@ -37,7 +37,7 @@ object lazfpsmainform: Tlazfpsmainform
end end
object editSourceFile: TFileNameEdit object editSourceFile: TFileNameEdit
Left = 136 Left = 136
Height = 21 Height = 23
Top = 8 Top = 8
Width = 136 Width = 136
DialogOptions = [] DialogOptions = []
@@ -52,7 +52,7 @@ object lazfpsmainform: Tlazfpsmainform
Left = 8 Left = 8
Height = 15 Height = 15
Top = 14 Top = 14
Width = 116 Width = 106
Caption = 'Source Spreadsheet:' Caption = 'Source Spreadsheet:'
ParentColor = False ParentColor = False
end end
@@ -69,7 +69,7 @@ object lazfpsmainform: Tlazfpsmainform
Left = 424 Left = 424
Height = 96 Height = 96
Top = 8 Top = 8
Width = 230 Width = 264
Lines.Strings = ( Lines.Strings = (
'memoCellData' 'memoCellData'
) )
@@ -80,7 +80,7 @@ object lazfpsmainform: Tlazfpsmainform
Left = 8 Left = 8
Height = 15 Height = 15
Top = 40 Top = 40
Width = 72 Width = 66
Caption = 'Current Cell:' Caption = 'Current Cell:'
ParentColor = False ParentColor = False
end end

View File

@@ -9,7 +9,7 @@ uses
StdCtrls, Grids, EditBtn, ExtCtrls, ComCtrls, fpspreadsheetchart, StdCtrls, Grids, EditBtn, ExtCtrls, ComCtrls, fpspreadsheetchart,
fpspreadsheetgrid, TAGraph, TASeries, TypInfo, fpspreadsheetgrid, TAGraph, TASeries, TypInfo,
// FPSpreadsheet and supported formats // FPSpreadsheet and supported formats
fpspreadsheet, fpsallformats fpstypes, fpspreadsheet, fpsallformats
; ;
type type
@@ -46,6 +46,10 @@ implementation
{$R *.lfm} {$R *.lfm}
uses
fpsUtils;
{ Tlazfpsmainform } { Tlazfpsmainform }
procedure Tlazfpsmainform.btnLoadSpreadsheetClick(Sender: TObject); procedure Tlazfpsmainform.btnLoadSpreadsheetClick(Sender: TObject);
@@ -73,7 +77,7 @@ begin
Worksheets[i].Parent := lCurPage; Worksheets[i].Parent := lCurPage;
Worksheets[i].Align := alClient; Worksheets[i].Align := alClient;
//Worksheets[i].Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll] //Worksheets[i].Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
Worksheets[i].LoadFromWorksheet(lCurWorksheet); Worksheets[i].LoadFromWorkbook(Workbook, i); //LoadFromWorksheet(lCurWorksheet);
Worksheets[i].OnSelection := @HandleSelectionChanged; Worksheets[i].OnSelection := @HandleSelectionChanged;
lCurPage.Caption := lCurWorksheet.Name; lCurPage.Caption := lCurWorksheet.Name;
end; end;
@@ -84,12 +88,14 @@ var
lX, lY, lCurTab: LongInt; lX, lY, lCurTab: LongInt;
lCurWorksheet: TsWorksheet; lCurWorksheet: TsWorksheet;
lCurCell: PCell; lCurCell: PCell;
fmt: PsCellFormat;
begin begin
lCurTab := pagesSheets.TabIndex; lCurTab := pagesSheets.TabIndex;
lX := Worksheets[lCurTab].Selection.Left; lX := Worksheets[lCurTab].Selection.Left - 1; // -1 for fixed rows/cols
lY := Worksheets[lCurTab].Selection.Top; lY := Worksheets[lCurTab].Selection.Top - 1;
lCurWorksheet := Workbook.GetWorksheetByIndex(lCurTab); lCurWorksheet := Workbook.GetWorksheetByIndex(lCurTab);
lCurCell := lCurWorksheet.GetCell(lY, lX); lCurCell := lCurWorksheet.GetCell(lY, lX);
fmt := Workbook.GetPointerToCellFormat(lCurCell^.FormatIndex);
memoCellData.Lines.Text := ''; memoCellData.Lines.Text := '';
memoCellData.Lines.Add(Format('Row: %d Col: %d (zero-based)', [lY, lX])); memoCellData.Lines.Add(Format('Row: %d Col: %d (zero-based)', [lY, lX]));
memoCellData.Lines.Add(Format('ContentType: %s', [GetEnumName(TypeInfo(TCellContentType), integer(lCurCell^.ContentType))])); memoCellData.Lines.Add(Format('ContentType: %s', [GetEnumName(TypeInfo(TCellContentType), integer(lCurCell^.ContentType))]));
@@ -97,11 +103,11 @@ begin
memoCellData.Lines.Add(Format('UTF8StringValue: %s', [lCurCell^.UTF8StringValue])); memoCellData.Lines.Add(Format('UTF8StringValue: %s', [lCurCell^.UTF8StringValue]));
//memoCellData.Lines.Add(Format('DateTimeValue: %s', [lCurCell^.DateTimeValue])); //memoCellData.Lines.Add(Format('DateTimeValue: %s', [lCurCell^.DateTimeValue]));
//memoCellData.Lines.Add(Format('UsedFormattingFields: %f', [lCurCell^.NumberValue])); //memoCellData.Lines.Add(Format('UsedFormattingFields: %f', [lCurCell^.NumberValue]));
memoCellData.Lines.Add(Format('TextRotation: %s', [GetEnumName(TypeInfo(TsTextRotation), integer(lCurCell^.TextRotation))])); memoCellData.Lines.Add(Format('TextRotation: %s', [GetEnumName(TypeInfo(TsTextRotation), integer(fmt^.TextRotation))]));
//memoCellData.Lines.Add(Format('Border: %f', [lCurCell^.NumberValue])); //memoCellData.Lines.Add(Format('Border: %f', [lCurCell^.NumberValue]));
memoCellData.Lines.Add(Format('BackgroundColor: %s', [GetEnumName(TypeInfo(TsColor), integer(lCurCell^.BackgroundColor))])); memoCellData.Lines.Add(Format('BackgroundColor: %s', [GetColorName(fmt^.Background.BgColor)]));
memoCellData.Lines.Add(''); memoCellData.Lines.Add('');
memoCellData.Lines.Add(Format('ReadAsUTF8Text(): %s', [lCurWorksheet.ReadAsUTF8Text(lY, lX)])); memoCellData.Lines.Add(Format('ReadAsText(): %s', [lCurWorksheet.ReadAsText(lY, lX)]));
end; end;
procedure Tlazfpsmainform.DeleteAllSheets; procedure Tlazfpsmainform.DeleteAllSheets;