Paragraph Attributes

[Top]  [Chapter]  [Previous]  [Next]

TextDynamic supports various paragraph attributes. Not only indents and spacing, but also paragraph color, shading and numbering.

 

Memo.CurrPar can be used to indent the current paragraph:

 

            IWPMemo Memo = wpdllInt1.Memo;

            IWPParInterface Attr = Memo.CurrPar;

 

            Attr.ParASet((int)WPAT.IndentLeft, 360);

            Attr.ParASet((int)WPAT.IndentFirst, -360);

            wpdllInt1.Focus();

 

It is also possible to modify all selected paragraphs.

To do so Attr.SetProp(1,1) must be called before the process to create a paragraph list, and SetProp(1,0) must be called to clear it.

 

In this example we also modify the tab stops and insert text in each paragraph.

 

            IWPMemo Memo = wpdllInt1.Memo;

            IWPParInterface Attr = Memo.CurrPar;

 

            Attr.SetProp(1, 1);

            try

            {

                Attr.ParASet((int)WPAT.IndentLeft, 1440);

                Attr.ParASet((int)WPAT.IndentFirst, -1440);

                Attr.TabAdd(1440, 0, 0, 0);

                // Insert text at the start of each paragraph

                Attr.InsertText(0, "-\t", -1);

            }

            finally

            {

                Attr.SetProp(1, 0);

            }

            Memo.Reformat();

            wpdllInt1.Focus();

 

Most of the IWPParInterface methods and properties can work with a paragraph list.

 

We added the icon workswithseltext to the topics of the methods which do.

 

When using ParASet You need to use an id (WPAT_code) to identify the attribute plus the value.

 

This are the most important IDs for paragraph attributes:

 

 WPAT_IndentLeft = 17 - the left indent in twips

 WPAT_IndentRight = 18; - the right indent in twips

 WPAT_IndentFirst = 19; - the first indent in twips (can be negative, too)

 WPAT_SpaceBefore = 20 - the space before a paragraph

 WPAT_SpaceAfter = 21; - the space after a paragraph

 WPAT_LineHeight = 22; - the LineHeight in in % ( Has priority over WPAT_SpaceBetween)

 WPAT_SpaceBetween = 23; - the space between paragraphs. When negative : Absolute, When Positive minimum

 

 // padding, only in tables:

 WPAT_PaddingLeft = 24 - Distance from Border to Text in twips (CSS = padding) tscellpaddt / trpaddl

 WPAT_PaddingRight = 25 - Distance from Border to Text (CSS = padding)

 WPAT_PaddingTop = 26- Distance from Border to Text (CSS = padding)

 WPAT_PaddingBottom = 27- Distance from Border to Text (CSS = padding)

 

 // Alignment

 WPAT_Alignment = 29 - horizontal alignment: 0=left, 1=center, 2=right, 3=justified

 WPAT_VertAlignment = 30 - vertical alignment: 0=top, 1=center, 2=bottom

 

 

This code will create bullets for the selected paragraphs

 

          IWPMemo Memo = wpdllInt1.Memo;

          IWPAttrInterface Attr = Memo.TextAttr;

          IWPNumberStyle style;

           style = Memo.GetNumberStyle(-1,1,0); // Bullet

 

          if(style!=null)

           {

               style.TextA = "¢"; // after text = "."

               style.Font="WingDings";

               style.Indent = 360;

           }

           Attr.AttrSET((int)WPAT.NumberSTYLE, style.ID);

 

           wpdllInt1.ReleaseInt(style);

 

 

 

 


[paragraph_attributes.htm]    Copyright © 2007 by WPCubed GmbH