[Solved] WorksheetGrid ... the rows collapse lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- Z80 · 2022-03-21 19:40 Hello again. In my little spreadsheet application I am applying a filter to the data to be visible in sWorksheetGrid1. To test that I made a little code like this: 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   Form2:=TForm2.Create(Nil);  Form2.ShowModal;  If (Form2.ComboBox1.ItemIndex<0) OR (Form2.Edit1.Text='') then exit;    case Form2.ComboBox1.ItemIndex of    0: Begin { Prj }       Krit:=StrToInt(Form2.Edit1.Text);         For n:=1 to GetLastRow(InSh) do         begin         Value:=InSh.ReadAsNumber(n,Prj);           if (Value=Krit) then Form1.sWorksheetGrid1.ShowRow(n)                           else Form1.sWorksheetGrid1.HideRow(n);         end;       end;    1: begin showmessage('1') end;    2: begin showmessage('2') end;    otherwise    showmessage('Error');    end;  Form2.Free; Basically it works. At least first time - but when I operate a second time with another criterium (Krit variable) the row height seems to collapse as can be seen in attached png. If I save the workbook I can see that all the data is there and the rows not matching the criteria are hidden. All as supposed. So I assume that it is a presentation/WorksheetGrid issue. Any help in solving this is appreciated. ---------------------------------------------------------------------- Z80 · 2022-03-21 21:53 I did another little test. where I after a filtering og the sWorksheetGrid1 contents added this code: 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 For n:=1 to GetLastRow(InSh) do sWorksheetGrid1.ShowRow(n);Result is in attached png. The rows which were not initially hidden are unchanged, the rows that have been hidden are collapsed. As if font had zero height. ---------------------------------------------------------------------- Z80 · 2022-03-22 07:54 I work with an ods file. Are some of the other formats better for keeping things in control? Actually I also have troubles getting the cell protection work in this application. Is csv a better fileformat to work on? It stores nothing but data. I wouldnt mind do the formatting, protection etc in Lazarus on startup. ---------------------------------------------------------------------- wp · 2022-03-22 10:01 Open the file fpsvisualutils.pas in folder source/visual of your FPSpreadsheet installation and find the implementation of the function RichTextHeight. Remove the first instruction which is 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   if (ARect.Left = ARect.Right) or (ARect.Top = ARect.Bottom) then    exit(0); At the moment I don't know whether removing these lines has any side- effects. Therefore, please test carefully (you seem to be one of the few users showing and hiding rows) and report issues related to row heights. ---------------------------------------------------------------------- Z80 · 2022-03-22 21:59 The fix works - whatever the reasons are for its necessity. Thank you very much. ---------------------------------------------------------------------- wp · 2022-03-22 22:17 Quote from: Z80 on March 22, 2022, 10:59:58 pmwhatever the reasons are for its necessity. A row in hidden state has zero height. When this row should become visible again, the grid must recalculate the height of this row. But the mentioned condition bypassed cell height calculation in case of zero cell height. Probably there is a better solution since the worksheet row record still contains the row height that had been valid before the row was hidden. Therefore this entire step should be handled differently. But at the moment I don't have the time to work through all the details... ---------------------------------------------------------------------- Z80 · 2022-03-29 22:25 Behavior and fix is similar in windows and linux regarding this.