IWPTextCursor.ASetCellStyle

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

Applies to

IWPTextCursor

Declaration

void ASetCellStyle(int HeaderRows, [In] bool OddRows, bool EvenRows, int FooterRows, int FromColumn, int ToColumn, string StyleName, int Mode);

Description

Applies a certain attribute to either header, footer or body rows. For table body rows you can select if odd and/or even rows should be changed.

 

The value of HeaderRows or FooterRows must be the negative to leave this rows unchanged!

 

It is possible to only set a range (1...n ) of columns or a complete rows with both FromColumn and ToColumn = 0.

 

If parameter Modes<33 it is used as bit-field:

0 : Select the paragraph style (adds it if necessary)

1 : Select the paragraph style and clear the paragraph attributes

2 : Select the paragraph style and clear the character attributes stored in the paragraph

4 : Select the paragraph style and clear the character attributes of the text!

 

Otherwise the following modes are supported:

33 : Initialize the cell text with the text provided as "StyleName"

34 : Append the text provided as "StyleName"

35 : Format the current row number according to the format string StyleName

 

 

Example:

// Odd rows should use style "td_odd"

TextCursor.ASetCellStyle( -1truefalse, -100"td_odd"0);

// Even rows should use style "td_even"

TextCursor.ASetCellStyle( -1falsetrue, -100"td_even"0);

// Header and footer should use style "td_header"

TextCursor.ASetCellStyle( 1falsefalse100"td_header"0);

// First column should be numbered (SetText)

TextCursor.ASetCellStyle( -1truetrue, -111"(%d)", 35);

 

// Update the styles.

// Note: CurrStyle could be also used directly after ASetCellStyle!

Memo.SelectStyle("td_odd");

Memo.CurrStyle.ParASet((int)WPAT.FGColor, 2); // green

Memo.SelectStyle("td_even");

Memo.CurrStyle.ParASet((int)WPAT.FGColor, 1); // red

Memo.SelectStyle("td_header");

Memo.CurrStyle.ParASet((int)WPAT.FGColor, 15); // black

 

// Format and update

Memo.ReformatAll(falsetrue);

 

 

clip0169

 

 

 


[iwptextcursor_asetcellstyle.htm]    Copyright © 2007 by WPCubed GmbH