InputCell Method

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

Applies to

IWPTextCursor

Declaration

void InputCell(string Text, sting StyleName);

Description

Creates a new Cell in the row which was started with InputRowStart. The borders will be added if bit 1 was set in the mode parameter for method InputRowStart. You can also change the border and other paragraph attributes by accessing the interface CurrPar.

 

Parameters

Text : Initialization text for this cell. You can use CurrPar to modify the cell.

Stylename : Name of the paragraph style this cell should use.

Example:

 

Create a table with inserted mail merge fields.

 

 IWPMemo Memo;

 Memo = WPDLLInt1.Memo;

 IWPTextCursor TextCursor = Memo.TextCursor;

 IWPAttrInterface CurrParAttr = Memo.CurrParAttr;

 IWPParInterface par = Memo.CurrPar;

 

 TextCursor.InputTable(0"data");

 

 For (int r = 1; r <= 10; r++)

 {

     TextCursor.InputRowStart(1);

     if (r & 1 == 1// odd rows

     {

                            for (int c = 0; c < 3; c++)

                            {

                                TextCursor.InputCell("""");

 

                                if (c < 2) par.ParASet((int)WPAT.COLWIDTH_PC, 20 * 100);

                                if (c == 2) par.ParASet((int)WPAT.COLWIDTH_PC, 60 * 100);

 

                                if (c == 0) TextCursor.InputField("NR_A""NR_A_TEXT"false);

                                if (c == 1) TextCursor.InputField("NR_B""NR_A_TEXT"false);

                                if (c == 2) TextCursor.InputField("DESCRIPTION""DESCRIPTIONTEXT"false);

                                par.ParASet((int)WPAT.BorderType, 15);

                                par.ParASet((int)WPAT.BorderWidth, 25);

                            }

      }

      else // even rows

      {

                            for (int c = 0; c < 3; c++)

                            {

                                TextCursor.InputCell("""");

 

                                if (c == 0) TextCursor.InputField("MEMO""MEMO_TEXT"false)

                                else par.IsColMerge = true;

                

                                par.ParASet((int)WPAT.BorderType, 15);

                                par.ParASet((int)WPAT.BorderWidth, 25);

                                par.ParASet((int)WPAT.BorderWidth, 25);

                            }

       }

       TextCursor.InputRowEnd();

 }

 TextCursor.InputParagraph(0,"");

 Memo.Reformat();  

 

Note: In this example we create fields in each cell using InputField. When you merge long texts suing the event OnFieldGetText event you will need Contents.ContinueOptions(256) to make sure the paragraph attributes of the inserted text are preserved.

Category

Table Support


[idh_iwptextcursor_inputcell.htm]    Copyright © 2007 by WPCubed GmbH