Adding additional formatting when inserting RVF from stream

General TRichView support forum. Please post your questions here
Post Reply
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Adding additional formatting when inserting RVF from stream

Post by martindholmes »

Hi there,

I'm struggling with a process whereby I insert a sequence of little documents into a main document. The small documents are stored as RVF. When I insert them into the main document, I need them to become list items. This is the process I'm using:
  • Add a list marker.
    Add a space.
    Stream in the small document (using InsertRVFFromStreamEd).
This works fine, except that, if the small document contains multiple paragraphs, the indenting of the list is screwed up; each new paragraph starts from the margin. I'd like the whole of the inserted document to appear as a list item; in other words, all its margins need to inherit the LeftIndent setting of the list style.

Is there any simple way to do this? I guess I could load the RVF of the small document into another offscreen RichView, then iterate through all the styles and add to the LeftIndent value, but it would be great if there were an easier method.

All help appreciated,
Martin
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

No, there is only way: loading in offscreen TRichView and modifying paragraph properties. It is quite simple. But you need to decide what to do with list markers that can be in the document. Or what if it is started from table or break (they cannot be markered)
martindholmes
Posts: 131
Joined: Mon Aug 29, 2005 12:03 pm

Post by martindholmes »

I seem to have found a solution to this, so I'm posting it in case anyone else is facing a similar problem (trying to insert a sequence of smaller documents in the form of a numbered list). This is what I do:

For each subdocument:
  • Set the cursor to the end of the document
    Insert an appropriate number ('1. ', '2. ', etc.)
    Set the cursor to the end again.
    Insert the subdocument as rvf from stream (InsertRVFFromStreamEd)
    Select all of the items I just inserted
    Apply a para style change to increase all indents by 20
    Select the first item I just inserted (with the cursor at the beginning of it, zero selection length)
    Apply a para style change to decrease the FirstIndent by 20
This seems to have the desired effect: A numbered list with hanging indents, and sub-paragraphs of each item honouring the indent.

Cheers,
Martin
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, this method works, and since only editing operations are used, it will always produce valid documents.
The only problem - this method is slower than using non-editing methods.
Post Reply