Format table in code

  • Hi,

    I can't figure out how to create a table in a document where you combine cells in the top row so that they will span a number of cells in lower rows.

    Any suggestions how this could be done? I have found the combine cells method which works if the cells are selected with the mouse, but I can't find how to do the whole process in code.

    Thanks

  • Also, I can't figure out how to do each of the following totally in code without doing the selecting with the mouse:

    1. Adjust a column size after creating the table in the same code block
    2. Select a number of adjacent cells in a table in code without selecting the whole row or column. It is possible to do such a selection with the mouse.

    Thanks.[/list]

    • Offizieller Beitrag

    Hi,

    1) I can't figure out how to create a table in a document where you combine cells in the top row so that they will span a number of cells in lower rows.

    if the cursor is in a table cell you can use CurrPar.IsColMerge and IsRowMerge.
    IWPMemo memo = wpdllInt1.Memo; memo.CurrPar.IsColMerge = true;
    memo.Reformat();

    This must be executed for the cell which should be merged with the previous.


    2) Adjust a column size after creating the table in the same code block

    The IWPTextCursor has the method SetColWidth. That should do it.


    3) Select a number of adjacent cells in a table in code without selecting the whole row or column. It is possible to do such a selection with the mouse.

    Currently there is no way to do it. But using the IWPParInterface it should be possible to perform all changes.

    I would recommend to use either the callback and AddTable to apply the format to each cell or use the InputTable method and modify CurrPar.

    Also see: https://www.wpcubed.com/manuals/textdy…_cat_tables.htm


    Kind Regards,

    Julian