Word interop C# Generating Table and Generate sub rows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shahjapan
    New Member
    • Apr 2007
    • 63

    #1

    Word interop C# Generating Table and Generate sub rows

    Hello,

    I am creating a Office Word 2003 Addin.
    in which I am using Mail Merge through C# coding.

    I required to generate a Temporary Data Source which contains a complex structure.

    Can anybody tell me how to create sub rows in a Cell of a table ?

    I tried to insert sub rows in a cell of table through C# but it adds rows to entire table,

    Then I tried to merge other coulmns other then the required Cell but its too complex as I may have several Cells already merged too.

    I just wanna know how to insert sub rows in a Cell of existing table's row's Cell.

    Any help will be appreciated.

    Regards,
    Japan Shah
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by shahjapan
    Hello,

    I am creating a Office Word 2003 Addin.
    in which I am using Mail Merge through C# coding.

    I required to generate a Temporary Data Source which contains a complex structure.

    Can anybody tell me how to create sub rows in a Cell of a table ?

    I tried to insert sub rows in a cell of table through C# but it adds rows to entire table,

    Then I tried to merge other coulmns other then the required Cell but its too complex as I may have several Cells already merged too.

    I just wanna know how to insert sub rows in a Cell of existing table's row's Cell.

    Any help will be appreciated.

    Regards,
    Japan Shah
    I'm not sure what you mean by sub rows.
    Could you explain this a bit more.

    What I think you're going to want to do is create a table for your "sub rows"...call it SubTable. Then you're going to want to add rows to your SubTable. Once you're done adding rows to this table, you're going to want to add it to your main table within the cell you want to add it to.

    Hope this helps.

    -Frinny

    Comment

    • shahjapan
      New Member
      • Apr 2007
      • 63

      #3
      I mean I want to split some of cells vertically,
      I tried it but using split we can not get the Row Level Operation so we can not get the Cell Address.

      but I think without split we can not do it.

      I tried
      Code:
       
      object NumRows = many2manyData.Length; 
      object NumColumns = 1;
      currentRow.Cells[current_column].Split(ref NumRows,ref NumColumns);
      The main problem is how to get the rowIndex and columnIndex of splited Cell.

      but after that I am no longer able to get the address of the new splited cell. becoz following generate Exception.

      Code:
      currentRow.Cells[current_column].Next.Range.Text = "hi";
      Originally posted by Frinavale
      I'm not sure what you mean by sub rows.
      Could you explain this a bit more.

      What I think you're going to want to do is create a table for your "sub rows"...call it SubTable. Then you're going to want to add rows to your SubTable. Once you're done adding rows to this table, you're going to want to add it to your main table within the cell you want to add it to.

      Hope this helps.

      -Frinny
      Last edited by shahjapan; Sep 11 '07, 09:48 AM. Reason: Added some imp information.

      Comment

      Working...