Get RVF from Database SQL Server (filestream)

General TRichView support forum. Please post your questions here
Post Reply
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Get RVF from Database SQL Server (filestream)

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

Post 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.
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Post 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
retwas
Posts: 39
Joined: Tue May 21, 2013 1:41 pm

Post by retwas »

no ?
Sergey Tkachenko
Site Admin
Posts: 17604
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
Post Reply