Re: Extra Paragraphs, just load / save rtf to rtf/docx?
Posted: Mon Nov 07, 2022 6:01 pm
It looks like the problem is in saving tables that have table.BestWidth = 0 (i.e. table width must be calculated from widths of cells).
Widths of cells and borders are saved correctly.
By default, for auto-width tables, the component saves a table width equal to the width of this table in TRichView window, and it may be not exactly precise.
To save such tables as auto-width tables in RTF, assign the global variable from RVTable.pas.
In order to make this variable work for DocX as well, change in RVTable.pas function GetTableWidthStr.
The part "if BestWidth = 0 then" must be:
This change will be included in the next update.
Widths of cells and borders are saved correctly.
By default, for auto-width tables, the component saves a table width equal to the width of this table in TRichView window, and it may be not exactly precise.
To save such tables as auto-width tables in RTF, assign the global variable from RVTable.pas.
Code: Select all
RichViewTableDefaultRTFAutofit := True
The part "if BestWidth = 0 then" must be:
Code: Select all
function GetTableWidthStr: TRVAnsiString;
begin
if BestWidth = 0 then
begin
if RichViewTableDefaultRTFAutofit or (rvtoRTFAllowAutofit in Options) then
Result := '<w:tblW w:w="0" w:type="auto"/>'
else
Result := RVFormatA('<w:tblW w:w="%d" w:type="dxa"/>',
[RV_UnitsToTwips(GetWidth(ARVStyle, GetPixelsPerInch, 1), rvuPixels, GetPixelsPerInch)])
end