Setting table cell font properties

  • Julian,

    Can you tell me how to set all of the font properties in a single style when adding a new cell to a table. It is easy to do with InputString.
    e.g.

    'Style for odd rows (is empty)
    Memo.SelectStyle("DataOdd")

    'Style for even rows (shaded)
    Memo.SelectStyle("DataEven")
    Memo.CurrStyle.ParColor = WpdllInt1.ColorToRGB(Color.Blue)
    Memo.CurrStyle.ParShading = 20 ' 20% blue

    ...other code to create table as normal, then...

    TextCursor.InputCell(row("HouseShort"), "DataEven")

    How do I set the font size and name as well for the style DataEven so that the text entered into the cell also has its font characteristics set e.g. Arial size 10?

    I tried using the CurrStyle.SetCharAttr but that only works on a single character at a time and is very time consuming to use.

    Thanks

    • Offizieller Beitrag

    Hi,

    To set the character attributes in the currently selected style use CurrStyleAttr, example:

    Code
    wpdllInt1.Memo.CurrStyleAttr.SetFontface("Courier New")
    wpdllInt1.Memo.CurrStyleAttr.SetFontSize(22)

    The text you insert will only use this style if it does not define a character attribute on its own (inheritance principle). Therefor you can use -1 as second attribute to InputString to clear the current writing attribute "CharAttrIndex".

    Regards,
    Julian Ziersch