TsWorksheetGrid headers and cell formatting lazarus / 21-General ---------------------------------------------------------------------- dodgebros · 2023-11-21 04:17 How do I add the column names, i.e. column headers, to the TsWorksheetGrid?  At the moment I am doing this on the FormActivate event: 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  // load column names      WkBkGrid.Cells[1,1] := 'Grower ID';      WkBkGrid.Cells[2,1] := 'Plant ID';      WkBkGrid.Cells[3,1] := 'Plant Name';      WkBkGrid.Cells[4,1] := 'Size';      WkBkGrid.Cells[5,1] := 'Description';      WkBkGrid.Cells[6,1] := 'Price';      WkBkGrid.Cells[7,1] := 'Size Code';      WkBkGrid.Cells[8,1] := 'Category Code';      WkBkGrid.Cells[9,1] := '   Updated   ';      WkBkGrid.Cells[10,1] := 'Online Only (x)';   Is there a better way? Also, I need to center the column names in their cells horizontally, how can I do this? Thanks, TD ---------------------------------------------------------------------- wp · 2023-11-21 10:28 Use the grid property HorAlignment[ACol, ARow: Integer] or HorAlignments[ALeft, ATop, ARight, ABottom: Integer]: 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   WkBkGrid.HorAlignment[1, 1] := haCenter;  WkBkGrid.HorAlignment[2, 1] := haCenter;  ...  // or, shorter:  WkBkGrid.HorAlignments[1, 1, 10, 1] := haCenter;