Page 1 of 1

Get RVF from Database SQL Server (filestream)

Posted: Fri Oct 10, 2014 1:40 pm
by retwas
Hello,

I create a RVF a save it to database SQL Server as filestream.
Image

On my TForm I have a TRichViewEdit that I load like that

Code: Select all

RV1.LoadRVF('C:\test.rvf');
RV1.Format;
Thats ok but, I have a problem when I load this RVF from RichViewEdit that I create by code.

Code: Select all

sPathDocument := GetDocumentFromDataBase(352);
// sPathDocument = C:\doc352.rvf
RV2 := TYRichViexEdit.Create;
RV2.Parent := MyForm;
RV2.Style := RVStyle;
RV2.LoadRVF(sPathDocument);
RV2.Format;
I have this result :
Image

Have you idea why it's like this ?

Thanks

Posted: Sun Oct 12, 2014 11:27 am
by Sergey Tkachenko
1. The most probably, this RVF was saved without TextStyles and ParaStyles.
So, when loading in TRichView linked to RVStyle with the same items in TextStyles and ParaStyles, it looks like the original document. Otherwise, styles will be mismatched, and text styles linked to non-existing (with too large indexes) TextStyles will be displayed as white-on-red.

Solution: make sure that the editor saving RVF has rvfoSaveTextStyles and rvfoSaveParaStyles included in RVFOptions.
(in the editor that loads the file, must be RVFTextStylesReadMode = RVFParaStylesReadMode = rvf_sInsertMerge, but it is the default value).

2. Another possible reason: this editor is linked to the same TRVStyle component as another editor. When this another editor loads another RVF file, it loads TextStyles and ParaStyles from this another RVF file, and styles in all other editors linked to this TRVStyle become mismatched.

Solution: use its own TRVStyle component for each editor.

Posted: Mon Oct 13, 2014 8:19 am
by retwas
Hi,

Thanks for help, but I can create many RichView.
I need to keep property of my main TRVStyle.

Can you create Assign method ? Or how can I do ?

Thanks

Posted: Tue Oct 14, 2014 12:00 pm
by retwas
no ?

Posted: Wed Oct 15, 2014 3:52 pm
by Sergey Tkachenko
Sorry for the delay.

I recommend using the same RVStyle for several editors only if you have a fixed set of styles, i.e. they are not added and not deleted.
In this mode, you can have a single TRVStyle in your project, and assign RVFTextStylesReadMode = RVFParaStylesReadMode = rvf_sIgnore for all trichviews.