fpspreadsheet: Fix incorrect row height when row switches from hidden to visible (https://forum.lazarus.freepascal.org/index.php?topic=58792.msg438138#msg438138).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8218 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-03-22 10:11:23 +00:00
parent 321ebdb047
commit b5c5632668
2 changed files with 28 additions and 20 deletions

View File

@@ -5967,8 +5967,11 @@ begin
if h = 0 then
h := DefaultRowHeight; // Zoom factor is applied by getter function
end;
end else
end;
// No row record so far.
if lRow = nil then
begin
if Worksheet.GetCellCountInRow(sr) > 0 then
begin
// Case 1: This row does contain cells
@@ -5988,6 +5991,7 @@ begin
// Case 2: No cells in row
h := DefaultRowHeight; // Zoom factor is applied by getter function
end;
end;
inc(FZoomLock); // We don't want to modify the sheet row heights here.
RowHeights[ARow] := h;

View File

@@ -326,9 +326,10 @@ function RichTextWidth(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
var
painter: TsTextPainter;
begin
// In contrast to RichTextHeight, the next two lines have no effect on col
// width when a column switches from hidden to visible.
if (ARect.Left = ARect.Right) or (ARect.Top = ARect.Bottom) then
exit(0);
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
AFontIndex, ATextRotation, haLeft, vaTop, AWordWrap, ARightToLeft, AZoomFactor);
try
@@ -345,9 +346,12 @@ function RichTextHeight(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
var
painter: TsTextPainter;
begin
{ -- causes incorrect row height, when row switches from hidden to visible.
// see: https://forum.lazarus.freepascal.org/index.php/topic,58792.msg438090.html#msg438090
if (ARect.Left = ARect.Right) or (ARect.Top = ARect.Bottom) then
exit(0);
}
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
AFontIndex, ATextRotation, haLeft, vaTop, AWordWrap, ARightToLeft, AZoomFactor);
try