load userdefined style information to existing text

General TRichView support forum. Please post your questions here
Post Reply
Usch Wildt
Posts: 20
Joined: Fri Sep 29, 2006 11:30 am

load userdefined style information to existing text

Post by Usch Wildt »

Hello Sergey,

I have a question:
I use TRichview in an CB6-application where the users can create and format text modules. Later the users can select text modules to generate a document. I merge the document from the selected modules using InsertRVFFromStream.
Until now the RVStyle for the modules comes from a design time component. That is nessecary because I need continous lists in the resulting document.
No I would like to implement a possibility for the users to change the style, for example change the standard font size. I want all the existing text modules to change to the new format too.
I tried SaveINI (where the users can change the style) and LoadIni (into the existing text modules), but afterwards the lists in the resulting documents are not continous any more. So LoadINI seems to create a new list style each time.
Then I wondered if I can transfer only the style information (instead of the whole style) from the ini file to the existing style to keep the same liststyle and so the numbering to stay continous. So I would like to make rvstyle2->LoadINI, look for styles that exist in rvstyle1 (which is used for the text modules) and rvstyle2, and then transfer the style information between the corresponding styles. But now the problem is: the style names are not unique. How can I recognise them?

Can you give me a hint?

Thanks a lot,

Usch
Sergey Tkachenko
Site Admin
Posts: 17281
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, loading styles from ini-file deletes all existing styles and add new styles from ini-file.
But I do not understand why it causes problems with numeration.
Can you create a simple project reproducing the problem and send it to me?
Usch Wildt
Posts: 20
Joined: Fri Sep 29, 2006 11:30 am

Post by Usch Wildt »

about the numeration problem:
I had a problem with numbered lists; you gave me a fix for it; and you wrote (August 06): "The problem is in the following. Each list style has its own random generated identifier. These identifiers were created to distinguish lists with the same properties on merging (especially useful on copy-pasting). You do not create list style in TForm2 in code, you created it at design time, so its identifier must be fixed (stored in the form's DFM), all documents created in TForm2 must have list item with the same identifier, and lists must be continuous on merging. ..."
So as I have understood it, I have to use a style which is created at design time to get continously numbered lists in merged documents.
When I load the style from an ini file, it is created at run time and has another identifier, so the lists in merged documdents are not continous any more.

Usch
Sergey Tkachenko
Site Admin
Posts: 17281
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Ok, now I remember. The numbering problem occurs when you create document assembled from several docs.
Yes, the problem must be because of the similar reason: ListId is not stored in the file.
The following modification will be included in the next update:
RVStr.pas, add the line:

Code: Select all

  RVINI_LISTID           = 'ListId';
RVStyle.pas, TRVListInfo.SaveToINI, add the line:

Code: Select all

  WriteIntToIniIfNE(ini, Section, RVINI_LISTID , FListID, 0);
TRVListInfo.LoadFromINI, add the line:

Code: Select all

  FListID := ini.ReadInteger(Section, RVINI_LISTID, 0);
mboth
Posts: 26
Joined: Thu Nov 26, 2009 10:48 am
Location: Hannover, Germany.

Post by mboth »

Greetings Sergey and all,

sorry to reopen a very old topic, but I think it fits perfectly. In recent version of TRichView, the "ListId" in the styles.ini file has been replaced by a ListId per ListStyle, is that correct?

Although we have matching ListIds for the styles, we cannot get to work anymore continuous paragraph numbering using InsertRVFFromStream().

Environment: The RVF we insert is stored in a database, it's a system to compose complex documents from many small fragments.

Please advice or ask for further info.

Thanks
moritz
Post Reply