Bug in TXLSRow.SetHeight

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
mwhiting
Posts: 17
Joined: Tue Dec 23, 2014 4:32 am

Bug in TXLSRow.SetHeight

Post 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;
Post Reply