diff --git a/applications/lazspreadsheet/lazspreadsheet.lpi b/applications/lazspreadsheet/lazspreadsheet.lpi index b90b42234..c40b7e934 100644 --- a/applications/lazspreadsheet/lazspreadsheet.lpi +++ b/applications/lazspreadsheet/lazspreadsheet.lpi @@ -1,4 +1,4 @@ - + @@ -12,9 +12,6 @@ - - - @@ -41,7 +38,6 @@ - @@ -49,7 +45,6 @@ - @@ -57,7 +52,6 @@ - @@ -77,12 +71,6 @@ - - - - - - diff --git a/applications/lazspreadsheet/lazspreadsheet.res b/applications/lazspreadsheet/lazspreadsheet.res index e66ecf85f..e1df0e994 100644 Binary files a/applications/lazspreadsheet/lazspreadsheet.res and b/applications/lazspreadsheet/lazspreadsheet.res differ diff --git a/applications/lazspreadsheet/mainform.lfm b/applications/lazspreadsheet/mainform.lfm index 5a4c3fd5e..50c13a59a 100644 --- a/applications/lazspreadsheet/mainform.lfm +++ b/applications/lazspreadsheet/mainform.lfm @@ -8,7 +8,7 @@ object lazfpsmainform: Tlazfpsmainform ClientWidth = 700 OnCreate = FormCreate OnDestroy = FormDestroy - LCLVersion = '1.1' + LCLVersion = '1.7' object pagesSheets: TPageControl Left = 0 Height = 289 @@ -37,7 +37,7 @@ object lazfpsmainform: Tlazfpsmainform end object editSourceFile: TFileNameEdit Left = 136 - Height = 21 + Height = 23 Top = 8 Width = 136 DialogOptions = [] @@ -52,7 +52,7 @@ object lazfpsmainform: Tlazfpsmainform Left = 8 Height = 15 Top = 14 - Width = 116 + Width = 106 Caption = 'Source Spreadsheet:' ParentColor = False end @@ -69,7 +69,7 @@ object lazfpsmainform: Tlazfpsmainform Left = 424 Height = 96 Top = 8 - Width = 230 + Width = 264 Lines.Strings = ( 'memoCellData' ) @@ -80,7 +80,7 @@ object lazfpsmainform: Tlazfpsmainform Left = 8 Height = 15 Top = 40 - Width = 72 + Width = 66 Caption = 'Current Cell:' ParentColor = False end diff --git a/applications/lazspreadsheet/mainform.pas b/applications/lazspreadsheet/mainform.pas index 5b9cf6c36..77ee38989 100644 --- a/applications/lazspreadsheet/mainform.pas +++ b/applications/lazspreadsheet/mainform.pas @@ -9,7 +9,7 @@ uses StdCtrls, Grids, EditBtn, ExtCtrls, ComCtrls, fpspreadsheetchart, fpspreadsheetgrid, TAGraph, TASeries, TypInfo, // FPSpreadsheet and supported formats - fpspreadsheet, fpsallformats + fpstypes, fpspreadsheet, fpsallformats ; type @@ -46,6 +46,10 @@ implementation {$R *.lfm} +uses + fpsUtils; + + { Tlazfpsmainform } procedure Tlazfpsmainform.btnLoadSpreadsheetClick(Sender: TObject); @@ -73,7 +77,7 @@ begin Worksheets[i].Parent := lCurPage; Worksheets[i].Align := alClient; //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; lCurPage.Caption := lCurWorksheet.Name; end; @@ -84,12 +88,14 @@ var lX, lY, lCurTab: LongInt; lCurWorksheet: TsWorksheet; lCurCell: PCell; + fmt: PsCellFormat; begin lCurTab := pagesSheets.TabIndex; - lX := Worksheets[lCurTab].Selection.Left; - lY := Worksheets[lCurTab].Selection.Top; + lX := Worksheets[lCurTab].Selection.Left - 1; // -1 for fixed rows/cols + lY := Worksheets[lCurTab].Selection.Top - 1; lCurWorksheet := Workbook.GetWorksheetByIndex(lCurTab); lCurCell := lCurWorksheet.GetCell(lY, lX); + fmt := Workbook.GetPointerToCellFormat(lCurCell^.FormatIndex); memoCellData.Lines.Text := ''; memoCellData.Lines.Add(Format('Row: %d Col: %d (zero-based)', [lY, lX])); 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('DateTimeValue: %s', [lCurCell^.DateTimeValue])); //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('BackgroundColor: %s', [GetEnumName(TypeInfo(TsColor), integer(lCurCell^.BackgroundColor))])); + memoCellData.Lines.Add(Format('BackgroundColor: %s', [GetColorName(fmt^.Background.BgColor)])); memoCellData.Lines.Add(''); - memoCellData.Lines.Add(Format('ReadAsUTF8Text(): %s', [lCurWorksheet.ReadAsUTF8Text(lY, lX)])); + memoCellData.Lines.Add(Format('ReadAsText(): %s', [lCurWorksheet.ReadAsText(lY, lX)])); end; procedure Tlazfpsmainform.DeleteAllSheets;