Page 1 of 1

Bug in TXLSRow.SetHeight

Posted: Thu May 14, 2015 8:49 pm
by mwhiting
Row height (ht attribute) is correctly passed on to the xml, however the customHeight attr is not passed because it is not set unless setting the height before the row is created. This does not cause a problem when all rows in the worksheet have the same height, but shows up when trying to make them different heights.

Current code in XLSRow5.pas (version 50.20.41):

Code: Select all

procedure TXLSRow.SetHeight(AValue: integer);
begin
  if FRowItem <> Nil then
    FRowItem.Height := AValue
  else if AValue <> XLS_DEFAULT_ROWHEIGHT then begin
    FRowItem := FOwner.FCells.AddRow(FIndex,XLS_STYLE_DEFAULT_XF);
    FRowItem.Height := AValue;
    FRowItem.Options := FRowItem.Options + [xroCustomHeight];
  end;
end;
My code correction:

Code: Select all

procedure TXLSRow.SetHeight(AValue: integer);
begin
  if FRowItem = Nil then
    FRowItem := FOwner.FCells.AddRow(FIndex,XLS_STYLE_DEFAULT_XF);
  if AValue <> XLS_DEFAULT_ROWHEIGHT then begin
    FRowItem.Height := AValue;
    FRowItem.Options := FRowItem.Options + [xroCustomHeight];
  end;
end;