IWPTextCursor.ASetCellStyle |
[Top] [Chapter] [Previous] [Next] |
Applies to 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( -1, true, false, -1, 0, 0, "td_odd", 0); // Even rows should use style "td_even" TextCursor.ASetCellStyle( -1, false, true, -1, 0, 0, "td_even", 0); // Header and footer should use style "td_header" TextCursor.ASetCellStyle( 1, false, false, 1, 0, 0, "td_header", 0); // First column should be numbered (SetText) TextCursor.ASetCellStyle( -1, true, true, -1, 1, 1, "(%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(false, true);
|