trichview.com

trichview.support




Re: Bullet Numbering - runtime coding


Return to index


Author

Message

Sergey Tkachenko

Posted: 10/23/2004 9:40:38


>

> At runtime I would like to create a new document and be able to

> use bullet numbering. I need to create these on the fly.


This code adds a list style with one level with decimal numbering:


  with RVStyle1.ListStyles.Add.Levels.Add do begin

    ListType := rvlstDecimal;

    FormatString := '%s.';

    Font.Assign(RVStyle1.TextStyles[1]);

    FirstIndent := 24;

  end;


Let's assume that this is the only list style in RVStyle.ListStyles, i.e.

its index = 0.



How to create numbering.


1) Way 1: adding list marker as a paragraph start (make sure that you added

something to this paragraph after the list marker, otherwise this document

will be invalid)


   RV.Clear;

   RV.SetListMarkerInfo(-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 1',1, -1);

   RV.SetListMarkerInfo(-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 2',1, -1);

   RV.SetListMarkerInfo(-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 3',1, -1);

   RV.SetListMarkerInfo(-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 4',1, -1);

   RV.Format;


2) Way 2: adding paragraphs, then assigning list markers to them:


   RV.Clear;

   RV.AddNL('Line 1',1, 0);

   RV.SetListMarkerInfo(RV.ItemCount-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 2',1, 0);

   RV.SetListMarkerInfo(RV.ItemCount-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 3',1, 0);

   RV.SetListMarkerInfo(RV.ItemCount-1, 0, 0, 1, 0, False);

   RV.AddNL('Line 4',1, 0);

   RV.SetListMarkerInfo(RV.ItemCount-1, 0, 0, 1, 0, False);

   RV.Format;


The resulting documents are exactly the same in both cases.





Powered by ABC Amber Outlook Express Converter