[SOLVED] Getting cell contents in Worksheetgrid. lazarus / 31-LCL ---------------------------------------------------------------------- Hopestation · 2015-11-19 16:53 Hi. I am using the fpschart example included in the fpspreadsheet examples. This has an initial number of columns set to 27. I would like to reduce the number of columns at run time, after a spreadsheet has been loaded, by checking the cells in the first row, to the last column that has contents. I tried: if worksheetgrid.cell[n,0] = ''; This doesn't work because worksheetgrid doesn't have a cell option. Searching this forum shows using the writenumber for fpspreadsheet, but worksheetgrid doesn't have anything like this. Is it possible? Thanks ---------------------------------------------------------------------- wp · 2015-11-19 17:14 So far, the WorksheetGrid is just a container displaying the data from the underlying TsWorksheet. I have to think about it, maybe it is possible to add a Cells property to the grid without too much interference. There is one issue definitely: people using a stringgrid know that the first index is column, but for users of fpspreadsheet, the first index is the row index - what about TsWorksheetGrid? is belongs to both worlds... But anyway, you can always search the worksheet associated with the grid: call the worksheet's ReadAsText(row,col) method and check for an empty string: 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 var  sheet: TsWorksheet;  c: Cardinal;begin  sheet := WorksheetGrid.Worksheet;  for c:=0 to sheet.GetLastColIndex do    if sheet.ReadAsText(0, c) = '' then        do_something;end; Ah, and I should note that the method ReadAsText is available only in the trunk version of fpspreadsheet. It is called ReadAsUTF8Text in the older versions. ---------------------------------------------------------------------- Hopestation · 2015-11-19 17:45 Thanks WP. That worked perfectly.