I create 3 new text and 3 new paragraph styles in my TRVStyle component.
Create some text using these styles and save the file as RTF.
When I load the file back I get, what appears to be a conflicting set of requirements.
If I have the TextStyleMode and ParaStyleMode set to rvrsAddIfNeeded it seems to always add the styles to my list. It doesn't use the existing styles. So the colours of the text are correct but the style numbers are different.
If I set the StyleModes to rvrsClosest, it is now correct and is using the preset styles I have created.
But the problem now is that if I have some "Hidden" text or just some randomly coloured text (not one of my 3 predefined styles), I cannot load this back.
So I am forced to use rvrsAddIfNeeded. So what do I have to do to make this work and not behave as if it is rvrsAddAlways.
TRichViewEdit - RTF - Read file
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
I confirm the problem, it happens because of saving BiDiMode. Your document is LTR, so TRichView saves LTR text direction in RTF (except for RTL paragraphs).
And all text styles loaded from RTF become LTR instead of Unspecified.
I implemented resetting BiDiMode of text to Unspecified if it has the same BiDiMode as the parent paragraph/document. Additionally, some correction for saving is required.
It will be included in the next update. Let me know if you need this fix urgently.
PS: small correction to you demo: do not call Format after Clear before loading. It adds an empty line, you can see it before the loaded RTF content.
And all text styles loaded from RTF become LTR instead of Unspecified.
I implemented resetting BiDiMode of text to Unspecified if it has the same BiDiMode as the parent paragraph/document. Additionally, some correction for saving is required.
It will be included in the next update. Let me know if you need this fix urgently.
PS: small correction to you demo: do not call Format after Clear before loading. It adds an empty line, you can see it before the loaded RTF content.