TsWorksheetGrid in fpspreadsheetgrid -has Cols[].indexOf('string') been removed? lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- PaulANormanNZ · 2017-03-31 23:53 Hi, I set up a GUI project a while ago (pre 2014) to interface with pdftohtmlEX (http://soft.rubypdf.com/software/pdf2htmlex-windows- version and https://github.com/coolwanglu/pdf2htmlEX/wiki/Command- Line-Options). I use an sWorksheetGrid as an extended property sheet for the command line options (screenshot attached). I recently updated everything Lazarus (CodePilot style) and now  TsWorksheetGrid no longer supplies a .Cols stringlist which you can .indexOf('any string') to get the needed row number. I can't find anything under .Columns that does the same thing. I realise that I can write a function to do what is needed, but kept thinking that as I use it even in other projects (which I will want to update soon as well) there must be something already inbuilt to replace this neat functionality. var sWorksheetGrid2: TsWorksheetGrid;  {from unit fpspreadsheetgrid;    } ... ProgressBar1.Min:= strtoint(sWorksheetGrid2.Cells[2,  sWorksheetGrid2.Cols[0].IndexOf('  --first-page')]);  ... No longer works  Any advice would be appreciated please as so far I cant find any write up about it any where, Paul ---------------------------------------------------------------------- wp · 2017-04-01 07:53 Did TsWorksheetGrid ever work this way? I don't think so: TsWorksheetGrid always has inherited from TCustomDrawGrid which does not expose a property Cols -- this one belongs to TStringGrid which is NOT an ancestor of TsWorksheetGrid. Looking at your code fragment I suppose you want to find the cell which contains a specific text in a given column. You can use the search functionality of fpspreadsheet - have a look at the example demo_search in folder examples/other of fpspreadsheet. You code fragment would translate to this code (untested): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses  fpstypes, fpssearch, fpspreadsheet; function SearchInCol(Worksheet: TsWorksheet; ACol: Integer; AText: String): PCell;var  searchParams: TsSearchParams;  rowfound, colfound: Cardinal;begin  // Define the text to be searched for  searchParams.SearchText := AText;  // Search begins at current active cell --> put active cell to the top of the search column  searchParams.Options := [];  searchParams.Within := swColumn;  Worksheet.ActiveCellCol := ACol;  Worksheet.ActiveCellRow := 0;  // Do the search (supposing that the search text is unique)  with TSearchEngine.Create(Worksheet.Workbook) do begin    if FindFirst(searchParams, worksheet, rowfound, colfound) then      Result := Worksheet.FindCell(rowfound, colfound)    else      Result := nil;    Free;  end;end; // To be called like this  Progressbar1.Min := sWorksheetGrid2.Cells[2, SearchInCol(sWorksheetGrid.Worksheet, 0, '  --first-page')^.Row+1];  // +1 must be omitted of there are not header rows  P.S. Just to paint the text in grid cells in different colors and fonts, TsWorksheetGrid certainly is an overkill. Why don't you use a standard grid and define the fonts and colos in its OnPrepareCanvas event? ---------------------------------------------------------------------- PaulANormanNZ · 2017-04-01 10:12 Dear Wp, Thanks for the suggested code. QuoteDid TsWorksheetGrid ever work this way? I don't think so As you can see from my previous message attachment (slide to the right) the exe has compiled nicely (2014), nicely until just recently, and now won't - raising the .Cols area as the problem. That previously compiled app still works well. So I guess there must historically have been some code in the component to achieve this previously Thanks again, paul ---------------------------------------------------------------------- wp · 2017-04-01 11:04 I looked at the old svn notes of 2014, and, yes, you are right: in the old days, when I joined this project, TsWorksheetGrid did inherit from TsCustomStringGrid, and therefore had a Cols property. Because of duplicate storage of cell strings this inheritance was changed to TsCustomDrawGrid. So: you're out of luck. I won't bring this back because it requires permanant storage of cell texts in a stringlist although the texts are already stored in the underlying worksheet. Please use the proposed code, or more simpy, use a plain-old TStringGrid and implement a handler for the OnPreparecanvas event. I really don't see a good reason why you should pull spreadsheet capabilities into your program for just a minor modification of used fonts. From your screenshot, I think this should work: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.StringGrid1PrepareCanvas(sender: TObject; aCol, aRow: Integer;  aState: TGridDrawState);var  grid: TStringGrid;begin  grid := Sender as TStringGrid;  case ACol of    0: grid.Canvas.Font.Style := grid.Canvas.Font.Style + [fsBold];    2: grid.Canvas.Font.Color := clBlue;    3: begin         grid.Canvas.Font.Color := clGreen;         grid.Canvas.Font.Style := grid.Canvas.Font.Style + [fsItalic];       end;  end;end;