Page 1 of 1

Tables Width RTF error

Posted: Thu Jun 11, 2020 9:40 am
by israelgs
Hi,

I am observing that when a table is added to a TRichView document, or pasted from Word, the dimensions are set to Width: auto by default.

If the document is saved in RTF format, the tables are off the sheet. It is as if you did not take into account the right margin of the document. This is solved if the width is set manually (or just put Width: percent 100%).

The question is ... can you set the tables to be 100% wide by default? How could we do the same for tables that are pasted from Word?

Thank you.

PD: I used TRichView and TScaleRichView in latest versions.

Re: Tables Width RTF error

Posted: Wed Jul 01, 2020 5:07 pm
by Sergey Tkachenko
You can process OnItemAction event:

Code: Select all

procedure TForm3.RichViewEdit1ItemAction(Sender: TCustomRichView;
  ItemAction: TRVItemAction; Item: TCustomRVItemInfo;
  var Text: TRVUnicodeString; RVData: TCustomRVData);
begin
  if (ItemAction = rviaInserted) and (Item is TRVTableItemInfo) and
    (TRVTableItemInfo(Item).BestWidth = 0) then
    TRVTableItemInfo(Item).BestWidth := -100;
end;
But I do not think that this is a good idea.