Reply

Adding columns and data in Tables

I am trying to add columns and some data in a Table on a Draft sheet.

 

Dim oApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application")

Dim oDoc As SolidEdgeDraft.DraftDocument = oApp.ActiveDocument
Dim oTable As SolidEdgeDraft.Table = oDoc.Tables.Add()

Dim oTitles As TableTitles = oTable.Titles
Dim oTitle As TableTitle = oTitles.Add()
oTitle.value = "New Table"

oTable.Columns.Add(4, True) oTable.Rows.Add(4, True) Dim oCell As TableCell = oTable.Cell(2, 2) oCell.value = 12

oTable.Columns is marked Read-Only but strangely there is a Add method to it which works without errors.

The error is on the next line for the TableCell (E_FAIL).

Is a Table object meant only to be created interactively and accesed programatically ?

The first few lines do create a table on the sheet and also the Title property can be set through code.

The only problem is when adding columns, rows and data into the cells.

Is there a way to add columns, rows and data to the table ?

 

1 REPLY

Re: Adding columns and data in Tables

[ Edited ]

OK, found this to be working.

 

Dim oRows As TableRows = oTable.Rows
oRows.Add(1, True)
oRows.Add(2, True)

Dim oColumns As TableColumns = oTable.Columns
oColumns.Add(1, True)
oColumns.Add(2, True)

Dim oCell As TableCell = oTable.Cell(1, 1)
oCell.value = 100

An option to delete a topic should be made available when a solution is found by the person who orginally started the topic.