Bug on export of lists into RTF

General TRichView support forum. Please post your questions here
Post Reply
badevlad
Posts: 10
Joined: Thu Feb 01, 2007 12:59 pm
Location: Zhitomir, Ukraine
Contact:

Bug on export of lists into RTF

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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)
emo
Posts: 8
Joined: Wed Nov 21, 2007 7:40 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
badevlad
Posts: 10
Joined: Thu Feb 01, 2007 12:59 pm
Location: Zhitomir, Ukraine
Contact:

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

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