Page 1 of 1

RVFSaveToStream problem

Posted: Thu Dec 11, 2008 1:18 pm
by martindholmes
Hi Sergey,

I'm having a very strange problem with a TRichViewEdit control. I load small documents into it from streams, and save them out to streams. Here's the problem:

I load one of these documents, with colours and formatting, and it loads fine. Then I make a text style change (say I add underlining to a word). Then I save the document to stream. When I reload it from the stream, the underlining is gone. However, if I do the same thing again (make the same text underlined), save to stream, and reload again, this time the underlining persists.

I've been trying to figure this problem out for days, and I just can't find the source of the problem. Do you have any idea what might cause this?

I'm still using version 10.3, but I don't see anything in the changelog for 11 which would relate to this. These are the relevant properties of the TRichViewEdit:

Options = [rvoAllowSelection, rvoScrollToEnd, rvoShowPageBreaks, rvoTagsArePChars, rvoAutoCopyText, rvoAutoCopyUnicodeText, rvoAutoCopyRVF, rvoAutoCopyImage, rvoAutoCopyRTF, rvoFormatInvalidate, rvoDblClickSelectsWord, rvoRClickDeselects, rvoFastFormatting]

RVFOptions = [rvfoIgnoreUnknownCtrls, rvfoConvUnknownStylesToZero, rvfoUseStyleNames, rvfoSaveBack, rvfoLoadBack, rvfoSaveTextStyles, rvfoSaveParaStyles, rvfoSaveLayout, rvfoLoadLayout, rvfoSaveDocProperties, rvfoLoadDocProperties]

All help really appreciated,
Martin

Posted: Thu Dec 11, 2008 2:22 pm
by Sergey Tkachenko
Exclude rvfoUseStyleNames.

Posted: Fri Dec 12, 2008 12:33 pm
by martindholmes
That did it! But I'm not sure why.

Cheers,
Martin

Posted: Fri Dec 12, 2008 5:23 pm
by Sergey Tkachenko
When this option is included, names of styles are saved in RVF files instead of indices. It works correctly only if all styles have unique names (and makes sense when collections of styles are not saved in documents)