Page 1 of 1
TCustomRichViewEdit.LoadRVF Sometimes Fail
Posted: Tue Aug 24, 2010 11:50 pm
by padbotz
Hi,
Anybody here have an idea why the LoadRVF sometimes returns false? What are the factors that affects this? I've been trying to load a file which was being saved using SaveRVF..
Thanks in advance..
Posted: Wed Aug 25, 2010 5:56 am
by Sergey Tkachenko
One of the most possible reasons:
- document includes unregistered graphic class or control; TBitmap, TIcon, TMetafile and TJPEGImage do not need to be registered; for other graphic classes, as well as for all components inserted in the document, call RegisterClass, one time, before the first loading:
RegisterClass(TButton);
RegisterClass(TGifImage)
- styles are not saved in RVF and changed after saving:
* make sure each TRichViewEdit is linked to its own TRVStyle
* right click at TRichViewEdit at design time, choose Settings in the popup menu, make sure that "Allow adding styles dynamically" is set;
Posted: Thu Aug 26, 2010 1:13 am
by padbotz
Thank you so much sir for the reply..
Actually, my RichViewEdit is created at runtime & has its own style, could you pls check if the ff. options are fine during creation?:
-------------------------------------------------------
Options := [rvoAllowSelection, rvoScrollToEnd, rvoClientTextWidth, rvoShowPageBreaks,
rvoTagsArePChars, rvoAutoCopyText, rvoAutoCopyUnicodeText, rvoAutoCopyRVF, rvoAutoCopyImage,
rvoAutoCopyRTF, rvoFormatInvalidate, rvoDblClickSelectsWord, rvoRClickDeselects];
RTFOptions := [rvrtfSaveEMFAsWMF, rvrtfSaveJpegAsJpeg];
RTFReadProperties.UnicodeMode := rvruMixed;
RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;
RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;
RVFOptions := [rvfoSavePicturesBody, rvfoSaveBinary, rvfoSaveControlsBody, rvfoSaveBack,
rvfoLoadBack, rvfoSaveTextStyles, rvfoSaveParaStyles, rvfoSaveLayout, rvfoLoadLayout, rvfoSaveDocProperties,
rvfoLoadDocProperties];
-------------------------------------------------------
Based on what you've said about RegisterClasses, i'm doubting now my custom classes that will be inserted in the RichViewEdit, the RegisterClasses are in its own individual unit's Initialization.. Example:
-------------------------------------------------------
TCustomClass1 = class(TPanel)
private
...
...
end
...
initialization
RegisterClasses([TCustomClass1]);
end;
-------------------------------------------------------
Does this mean that i should transfer this to the unit in the Initialization section of the unit where the RichViewEdit is created? And should I include all the used classes (whether custom or not) inside that unit?
Thanks again in advance sir..
Posted: Thu Aug 26, 2010 10:04 am
by Sergey Tkachenko
It does not matter where you call RegisterClasses.
Calling them in your unit is ok.
PS: if your panel contains other components, they must be registered as well.
Posted: Thu Aug 26, 2010 11:02 pm
by padbotz
Only visual components must be registered right?
Posted: Fri Aug 27, 2010 8:29 am
by Sergey Tkachenko
No, any component that can be stored in RVF.
Posted: Fri Aug 27, 2010 8:36 am
by padbotz
Thank you so much for your help sir..