Hot to make not bold a table cell

  • Using code from the demos, I am creating the first row of a table, and later, I want to add more rows.

    The created row is shown to the user in the editor, and acts as a header, and also as a template, the user can change text properties and widths of the colums.

    Table creation uses the following code

    Code
    var  tbl: TParagraph;  // Create the table and after that modify the cells  WPRichText1.BeginTable('NAME', 0, 0, 0);  tbl := WPRichText1.TableAdd(4, 1, [wptblActivateBorders], nil, nil);  WPRichText1.EndTable;  // Set text of columns  tbl.Rows[0].Cols[0].SetText('Product');  tbl.Rows[0].Cols[1].SetText('Price');  tbl.Rows[0].Cols[2].SetText('Amount');  tbl.Rows[0].Cols[3].SetText('Total');

    Then, when the user wants to print the resulting document, I am adding rows with the following code

    The problem is that ASetCharStyle does not delete the bold flag from the new row, so how can I delete the bold flag from all the content of a table cell.

    • Offizieller Beitrag

    Please note the difference of attributes of text, paragraphs or cells and styles. The attribute inheritance is a follows:

    style
    |
    paragraph
    |
    character


    The toolbar buttons for bold, italic, fontname, fontsize etc only change attributes of text, not of paragraphs or styles. Those area always inherited.

    ASetCharStyle will change paragraph styles, not character attributes. Since it changes the attribute at a lower level, it does not affect the visual attribute of the text uses character attribute. So ASetCharStyle(false, WPSTY_BOLD) will have no visible effect.

    You will need to use ClearCharAttributes to revert the text attributes of a cell to default.