Workbook.disableNotifications lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- kjteng · 2020-08-13 03:09 I am trying to understand the disableNotifications method and its effect on following two sets of codes (code A correctly set the rowcount to 15 but the code B does not set the rowcount correctly). Any help? Code A: Quote  wsGrid1.Workbook.DisableNotifications;   try     wsGrid1.rowcount :=15;   finally     wsGrid1.Workbook.EnableNotifications;   end;   wbSource1.Workbook.ActiveWorksheet.WriteText(5, 1, 'rowcount=15');  Code B: Quote  wsGrid1.Workbook.DisableNotifications;   try     wsGrid1.rowcount :=5;   finally     wsGrid1.Workbook.EnableNotifications;   end;   wbSource1.Workbook.ActiveWorksheet.WriteText(15, 1, 'rowcount=5'); ---------------------------------------------------------------------- wp · 2020-08-13 08:39 If code B you initially set the grid's RowCount to 5, but then you write some text into a cell of worksheet row 15 (i.e. grid row 16). This way the RowCount is automatically expanded to 16 You could remove the option aeData from the WorksheetGrid's AutoExpand property in order to avoid automatic expansion of the RowCount by writing data, but then you'll have an exception because the addressed row does not exist.