diff --git a/components/fpspreadsheet/examples/visual/fpsctrls_no_install/demo_ctrls.lpi b/components/fpspreadsheet/examples/visual/fpsctrls_no_install/demo_ctrls.lpi index 8f924558f..8f6cb9564 100644 --- a/components/fpspreadsheet/examples/visual/fpsctrls_no_install/demo_ctrls.lpi +++ b/components/fpspreadsheet/examples/visual/fpsctrls_no_install/demo_ctrls.lpi @@ -59,6 +59,13 @@ + + + + + + + diff --git a/components/fpspreadsheet/examples/visual/fpsctrls_no_install/main.pas b/components/fpspreadsheet/examples/visual/fpsctrls_no_install/main.pas index 55ddf8750..a325a266f 100644 --- a/components/fpspreadsheet/examples/visual/fpsctrls_no_install/main.pas +++ b/components/fpspreadsheet/examples/visual/fpsctrls_no_install/main.pas @@ -7,7 +7,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls, ExtCtrls, Grids, Buttons, Menus, ActnList, StdActns, - fpstypes, fpspreadsheet, fpspreadsheetctrls, fpSpreadsheetGrid, fpsActions; + fpsTypes, fpSpreadsheet, fpSpreadsheetCtrls, fpSpreadsheetGrid, fpsActions; type diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index da15a0c22..821ec8099 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -98,9 +98,9 @@ type FLeftPaneWidth: Integer; FTopPaneHeight: Integer; FOptions: TsSheetOptions; - FLastFoundCell: PCell; - FLastFoundRow: Cardinal; - FLastFoundCol: Cardinal; +// FLastFoundCell: PCell; +// FLastFoundRow: Cardinal; +// FLastFoundCol: Cardinal; FFirstRowIndex: Cardinal; FFirstColIndex: Cardinal; FLastRowIndex: Cardinal; @@ -1108,9 +1108,9 @@ begin FActiveCellRow := Cardinal(-1); FActiveCellCol := Cardinal(-1); - FLastFoundCell := nil; +{ FLastFoundCell := nil; FLastFoundRow := Cardinal(-1); - FLastFoundCol := Cardinal(-1); + FLastFoundCol := Cardinal(-1);} FOptions := [soShowGridLines, soShowHeaders]; end; @@ -2085,7 +2085,7 @@ begin FLastFoundRow := ARow; FLastFoundCol := ACol; end; - } +} end; {@@ ---------------------------------------------------------------------------- diff --git a/components/fpspreadsheet/fpspreadsheetctrls.pas b/components/fpspreadsheet/fpspreadsheetctrls.pas index fcb49e2f3..9f7621361 100644 --- a/components/fpspreadsheet/fpspreadsheetctrls.pas +++ b/components/fpspreadsheet/fpspreadsheetctrls.pas @@ -816,30 +816,22 @@ end; -------------------------------------------------------------------------------} procedure TsWorkbookSource.InternalLoadFromFile(AFileName: string; AAutoDetect: Boolean; AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer = 0); -var - t: TTime; begin // Create a new empty workbook - t := now; InternalCreateNewWorkbook; - DebugLn(Format('[Timer] Create workbook: %.3f sec', [(now-t)*24*3600])); DisableControls; try - t := Now; // Read workbook from file and get worksheet if AAutoDetect then FWorkbook.ReadFromFile(AFileName) else FWorkbook.ReadFromFile(AFileName, AFormat); - DebugLn(Format('[Timer] Read file: %.3f sec', [(now-t)*24*3600])) finally EnableControls; end; - t := now; - SelectWorksheet(FWorkbook.GetWorkSheetByIndex(AWorksheetIndex)); - DebugLn(Format('[Timer] Select worksheet: %.3f sec', [(now-t)*24*3600])); + SelectWorksheet(FWorkbook.GetWorkSheetByIndex(AWorksheetIndex)); // If required, display loading error message if FWorkbook.ErrorMsg <> '' then diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index 0282603e8..b8a8e0243 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -1454,7 +1454,6 @@ var tmp: Integer = 0; begin inherited; - Canvas.SaveHandleState; try // Avoid painting into the header cells @@ -1463,15 +1462,12 @@ begin ColRowToOffset(True, True, FixedCols-1, tmp, cliprect.Left); if FixedRows > 0 then ColRowToOffset(False, True, FixedRows-1, tmp, cliprect.Top); - DrawFrozenPaneBorders(clipRect); rgn := CreateRectRgn(cliprect.Left, cliprect.top, cliprect.Right, cliprect.Bottom); SelectClipRgn(Canvas.Handle, Rgn); - DrawCellBorders; DrawSelection; - DeleteObject(rgn); finally Canvas.RestoreHandleState; @@ -1770,7 +1766,7 @@ end; procedure TsCustomWorksheetGrid.DrawRow(ARow: Integer); var gds: TGridDrawState; - sr, sr1,sc1,sr2,sc2: Cardinal; // sheet row/column + sr, sr1,sc1,sr2,sc2, scLastUsed: Cardinal; // sheet row/column gr, gc, gcNext, gcLast, gc1, gc2, gcLastUsed: Integer; // grid row/column i: Integer; rct, saved_rct, temp_rct, commentcell_rct: TRect; @@ -1835,11 +1831,13 @@ begin exit; end; + scLastused := Worksheet.GetLastColIndex; sr := GetWorksheetRow(ARow); // Draw columns in this row with GCache.VisibleGrid do begin + gcLast := Right; gc := Left; // Because of possible cell overflow from cells left of the visible range @@ -1873,7 +1871,7 @@ begin gcLast := Right; if FTextOverflow and (sr <> Cardinal(-1)) and Assigned(Worksheet) then begin - gcLastUsed := GetGridCol(Worksheet.GetLastOccupiedColIndex); + gcLastUsed := GetGridCol(scLastUsed); while (gcLast < ColCount-1) and (gcLast < gcLastUsed) do begin inc(gcLast); cell := Worksheet.FindCell(sr, GetWorksheetCol(gcLast)); @@ -3338,8 +3336,6 @@ end; -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string; AFormat: TsSpreadsheetFormat; AWorksheetIndex: Integer); -var - t: TTime; begin if FOwnsWorkbook then FreeAndNil(FOwnedWorkbook); @@ -3350,17 +3346,9 @@ begin begin BeginUpdate; try - t := now; CreateNewWorkbook; - DebugLn(Format('[Timer] Create workbook: %.3f sec', [(now - t)*24*3600])); - - t := now; Workbook.ReadFromFile(AFileName, AFormat); - DebugLn(Format('[Timer] Read file: %.3f sec', [(now - t)*24*3600])); - - t := now; LoadFromWorksheet(Workbook.GetWorksheetByIndex(AWorksheetIndex)); - DebugLn(Format('[Timer] Load into grid: %.3f sec', [(now - t)*24*3600])); finally EndUpdate; end; @@ -3376,8 +3364,6 @@ end; -------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.LoadFromSpreadsheetFile(AFileName: string; AWorksheetIndex: Integer); -var - t: TTime; begin if FOwnsWorkbook then FreeAndNil(FOwnedWorkbook); @@ -3388,17 +3374,9 @@ begin begin BeginUpdate; try - t := now; CreateNewWorkbook; - DebugLn(Format('[Timer] Create workbook: %.3f sec', [(now - t)*24*3600])); - - t := now; Workbook.ReadFromFile(AFilename); - DebugLn(Format('[Timer] Read file: %.3f sec', [(now - t)*24*3600])); - - t := now; LoadFromWorksheet(Workbook.GetWorksheetByIndex(AWorksheetIndex)); - DebugLn(Format('[Timer] Load into grid: %.3f sec', [(now - t)*24*3600])); finally EndUpdate; end; @@ -3676,14 +3654,14 @@ end; Saves the workbook into a file with the specified file name. If this file name already exists the file is overwritten if AOverwriteExisting is true. - @param AFileName Name of the file to which the workbook is to be - saved - If the file format is not known is is written - as BIFF8/XLS. - @param AOverwriteExisting If this file already exists it is overwritten if - AOverwriteExisting = true, or an exception is - raised if AOverwriteExisting = false. -} + @param AFileName Name of the file to which the workbook is to be + saved + If the file format is not known it is written + as BIFF8/XLS. + @param AOverwriteExisting If this file already exists it is overwritten if + AOverwriteExisting = true, or an exception is + raised if AOverwriteExisting = false. +-------------------------------------------------------------------------------} procedure TsCustomWorksheetGrid.SaveToSpreadsheetFile(AFileName: String; AOverwriteExisting: Boolean = true); begin