CurrPar property

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

Declaration

IWPParInterface CurrPar

Description

This is the interface to manipulate the current paragraph. This is the paragraph the cursor (insertion marker) is located within.

You can use this interface to read the text, to manipulate the text and to change the attributes of the paragraph. To change the attributes of all characters in this paragraph use the interface provided by CurrParAttr. If you only need to change the attribute of certain characters use either CharAttr or SetCharAttr.

 

This interfaces is also provided as IWPMemo.CurrPar.

 

When You are done and want the editor to be updated, please execute Memo.TextCommand 18, 0, 0

 

Important: The interfaces CurrPar and CurrParAttr always access the current cell/paragraph - they cannot be used to edit a cell/paragraph which lost focus.

 

Example:

 

IWPParInterface par = wpdllInt1.CurrPar;

// Clears the paragraph

par.SetText("",0);

// Appends new text using current writing mode

par.AppendText("Hello World",-1);

// activates all borders

par.Borders = 15;

// and shading

par.ParShading = 30;

par.ParColor = wpdllInt1.ToRGB(Color.Blue);

 

 

VB6 Example:

 

  Dim memo As IWPMemo

  Set memo = ActiveForm.rtfText.memo

  Dim currpar As IWPParInterface

  Set currpar = memo.currpar

 

  Select Case Button.Key

  ...

        Case "Left Aligned"

           currpar.Alignment = 0

           memo.Reformat 'Reformat when Idle

        Case "Centered"

           currpar.Alignment = 1

           memo.Reformat

        Case "Right Aligned"

           currpar.Alignment = 2

           memo.Reformat

  ...

 

 

 

 

 

TipYou can use paragraph id values in SetPtr to set the current paragraph reference to a different paragraph. See method AppendChild for an example.

 

Important VB6 note:

 

When using certain interfaces of TextDynamic please first create a variable and assign the value to it. Otherwise You likely get the error "Block variable not defined".

 

  Dim currpar As IWPParInterface

  Set currpar = wpdllInt1.currpar


[idh_wpdllint_currpar.htm]    Copyright © 2007 by WPCubed GmbH