Edit Existing Revision Line

Edit Existing Revision Line

pete.dehaan
Contributor Contributor
441 Views
3 Replies
Message 1 of 4

Edit Existing Revision Line

pete.dehaan
Contributor
Contributor

We have an existing Revision table on each drawing as created via the drawing template, it starts with a single blank row without a date or initials and the description is "Initial Release". I would like to populate the date and initials section with the users initials and the current date. This should always be the first row.

 

I have found plenty of examples for adding a new row, but not on how to edit an existing one. Any help would be appreciated.

0 Likes
Accepted solutions (1)
442 Views
3 Replies
Replies (3)
Message 2 of 4

JelteDeJong
Mentor
Mentor
Accepted solution

Is this what you are looking for?

Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.ActiveSheet

For Each revTab As RevisionTable In sheet.RevisionTables
    Dim firstRow As RevisionTableRow = revTab.RevisionTableRows.Item(1)

    ' You might need to change the (Column) numbers here.
    Dim revDate As RevisionTableCell = firstRow.Item(3)
    Dim initials As RevisionTableCell = firstRow.Item(2)

    Dim userName As String = ThisApplication.GeneralOptions.UserName

    If (String.IsNullOrEmpty(revDate.Text)) Then
        revDate.Text = DateTime.Now.ToString("yyyy-MM-dd")
    End If
    If (String.IsNullOrEmpty(initials.Text)) Then
        initials.Text = userName
    End If
Next

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 4

theo.bot
Collaborator
Collaborator

When you take your revision table there are to ways to change the table data, by row or by column. when you take a row you can then define the cell that you want to edit, it's the column number that your need. If you take the colomn, then you need to define the cell using the row number. When you have your cell then you can find the text property that you can override.

 

 

here is a small sample:

 

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document 

Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet

'Asuming a revision table is on the sheet
Dim oRevTable As RevisionTable
oRevTable = oSheet.RevisionTables(1)

'Change the value of the first cell of row 1
oRevTable.RevisionTableRows(1).Item(1).Text = "A"
'Change the value of the second cell of row 1
oRevTable.RevisionTableRows(1).Item(2).Text = "Changes made"
'Change the value of the third cell of row 1
oRevTable.RevisionTableRows(1).Item(3).Text = "4-11-2020" 

 

0 Likes
Message 4 of 4

pete.dehaan
Contributor
Contributor

That is exactly what I was after, only change required was changing the column numbers from 2 to 3 and vice versa. I had no idea how to specify a column and row number for a cell, the explanation is very helpful.

 

Thank you everyone.

0 Likes