Lazarus

Programming => Packages and Libraries => FPSpreadsheet => Topic started by: Tavr on June 03, 2021, 09:47:03 am

Title: BUG Cells unmerged when press delete key
Post by: Tavr on June 03, 2021, 09:47:03 am
When I press DELETE key in merged cells - cells unmerged.
In addition, another problem, when editing merged cells Editor shown only in first cell of merged cells (EditorLineMode=elmMultiLine)

Code: Pascal  [Select][+][-]
  1. procedure TsWorksheet.EraseCell(ACell: PCell; AKeepFormat: Boolean = false);
  2. var
  3.   r, c: Cardinal;
  4. begin
  5.   if ACell <> nil then begin
  6.     r := ACell^.Row;
  7.     c := ACell^.Col;
  8.  
  9.     // Unmerge range if the cell is the base of a merged block
  10.     if IsMergeBase(ACell) then
  11.       UnmergeCells(r, c);  
  12.  
Title: Re: BUG Cells unmerged when press delete key
Post by: wp on June 03, 2021, 12:05:46 pm
When I press DELETE key in merged cells - cells unmerged.
I modified the EraseCell method so that the KeepFormat parameter is respected also for merged cells.
Code: Pascal  [Select][+][-]
  1. procedure TsWorksheet.EraseCell(ACell: PCell; AKeepFormat: Boolean = false);
  2. ...
  3.     // Unmerge range if the cell is the base of a merged block
  4.     if IsMergeBase(ACell) and not AKeepFormat then
  5.       UnmergeCells(r, c);
  6. ...

In addition, another problem, when editing merged cells Editor shown only in first cell of merged cells (EditorLineMode=elmMultiLine)
This is by design. I always was confused by Excel treating all cells of a merged block equally although only the left/upper cell can be modified and carries the format of the block.
TinyPortal © 2005-2018