Page 1 of 1

Bug on export of lists into RTF

Posted: Tue Nov 20, 2007 3:10 pm
by badevlad
It looks like there are bug in export of numbered lists into RTF. To reproduce it do the following:

1. Create some numbered list in RichViewEdit.
2. Select several lines fully and copy them into Clipboard.
3. Paste in MSWord (or paste as RTF).

After these steps you will see in MSWord numbered list, but last line will be not marked as list item.

How can it be solved?

Posted: Tue Nov 27, 2007 7:21 pm
by Sergey Tkachenko
In TRichView development, there were several different solutions for saving attributes of the last copied paragraph (these attributes include bullet). MS Word ignores attributes of the last pasted paragraph, if ending "end of paragraph" mark (\par keyword) is not saved.
If I save \par at the end of any copied RTF content, extra line break will be added, it is undesirable.
I do not remember how it works in v1.9.24. The latest version (for registered users) saves \par only if the selection ends at the end of the document.
In the next update, it will also be saved if the selection ends at the end of paragraph.
This is also not a perfect solution, but I think it's more similar to MS Word (MS Word has "end of paragraph" mark as invisible character)

Posted: Wed Nov 28, 2007 2:01 am
by emo
One thing also - connecting to saving to rtf format. Actions "forget" about lists (bullets,numbering).
When we save as RTF (f.e save readme.rvf with ActionTest as rtf) and open again we can see lists and add items to them but according buttons (with rvActionsResource.rvActionParaBullets1, rvActionsResource.rvActionParaNumbering1) do not change their status when we move to lists.
Or do we have to change some settings in saving? I used default as their set in demo.
Word can load and "understand" those lists.

Posted: Thu Nov 29, 2007 9:56 am
by Sergey Tkachenko
Well, currently TrvActionParaBullets and TrvActionParaNumbering are checked only if the current paragraphs have bullets/numbering with exactly the same attributes as specified in their ListStyles property.
The problem is because when saving/reopening RTF, not all attributes are exactly the same as in the original values (because (1) paragraph attributes override them, (2) StartFrom properties are compared that make no sense for bullets).
Will be fixed in the next update.

Posted: Fri Nov 30, 2007 8:39 am
by badevlad
Can you give me a directions where I can fix it by myself? I am not sure that we are able to wait for next release.

Posted: Fri Nov 30, 2007 9:50 am
by Sergey Tkachenko
Assuming that you have the latest version of TRichView.
1) RVStyle.pas, function TRVListLevel.IsSimpleEqual
Change the line

Code: Select all

    (StartFrom = Value.StartFrom) and
to

Code: Select all

    (not HasNumbering or (StartFrom = Value.StartFrom)) and
2) CRVData.pas, function TCustomRVData.SaveRTFToStream
Between the lines

Code: Select all

if (MarkerItemNo<>StartItem) and (GetItemStyle(MarkerItemNo)=rvsListMarker) then begin
and

Code: Select all

GetItem(MarkerItemNo).SaveRTF(Stream, Path, Self, MarkerItemNo,
add:

Code: Select all

          if (rvrtfSaveStyleSheet in RTFOptions) and
            RVStyle.ParaStyles[GetItem(MarkerItemNo).ParaNo].Standard then
              RVFWrite(Stream, Format('\s%d', [GetItem(MarkerItemNo).ParaNo]));
          SaveParaStyle(GetItem(MarkerItemNo).ParaNo, ColorList,False, GetItem(MarkerItemNo));