This interface allows modification of the current paragraph, this is the paragraph the cursor is located in.
If you use the method TextCursor.InputTable, StartTableRow, InputCell, EndTableRow this property allows it to change the properties of the current paragraph/cell, table or table row.
Please note, that, even if you store the reference of the CurrPar interface to a variable, the interface will always modify the paragraph which is 'current' at the time you access methods of the interface. The same is true for the interfaces CurrParAttr.
The IWPMemo interface also publishes the interfaces CurrPar, CurrParAttr etc.
This interfaces are also published by IWPRTFDataBlock - this makes it possible to modify the text without moving the cursor!
This C# example appends formatted text:
IWPParInterface par = wpdllInt1.memo.CurrPar;
IWPAttrInterface atr = wpdllInt1.AttrHelper;
// Append normal text
atr.Clear();
par.AppendText("Normal ", atr.CharAttrIndex);
// bold text
atr.IncludeStyles(1);
par.AppendText("and bold", atr.CharAttrIndex);
This C# example adds arabic numbering to the current paragraph
IWPParInterface par;
par = WPDLLInt1.CurrPar;
if(par!=null)
{
par.IndentLeft = (int)(0.5 * 1440); // 1/2 inch
par.IndentFirst = -(int)(0.5 * 1440);
par.NumberMode = 3;
}
You can modify each of the propeties which is defined by a WPAT-code using the method ParASet and delete it using ParADel. To modify the attributes of the text use CurrParAttr or, for each individual character, CurrPar.CharAttr(index).
This code creates a table using TextCursor.InputTable. This is just one possibility to create a table. The other high level method is TextCursor.AddTable which requires a callback to set properties and fill in text. InputTable does not require a callback which makes it easy to use in interpreted code.
IWPMemo memo = wpdllInt1.Memo;
IWPAttrInterface atr = wpdllInt1.AttrHelper;
IWPParInterface par = memo.CurrPar;
IWPAttrInterface parattr = memo.CurrParAttr;
IWPTextCursor cursor = memo.TextCursor;
// Start a table
cursor.InputTable(0,"");
// use 50 % of the page width
par.ParASet((int)WPAT.BoxWidth_PC, 50*100);
// Now create 5 rows
for (int r = 1; r <= 5; r++)
{
cursor.InputRowStart(0);
// With 2 cells each, 10 and 90 % width
cursor.InputCell(r.ToString(),"");
par.ParASet((int)WPAT.COLWIDTH_PC, 10*100);
par.ParColor = wpdllInt1.ColorToRGB(Color.Gray);
parattr.IncludeStyles(1); // bold text
// The second cell uses different text attributes
cursor.InputCell("","");
par.ParASet((int)WPAT.COLWIDTH_PC, 90*100);
// Append normal text
atr.Clear();
par.AppendText("Normal ", atr.CharAttrIndex);
atr.IncludeStyles(1); // bold text
par.AppendText("and bold", atr.CharAttrIndex);
// This row is finished
cursor.InputRowEnd();
}
// Format and display
memo.ReformatAll(false, true);