AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Question Hi Rizwan,
Iam using visual studio 2008. I have a word template which has a table and I would like to know how to insert text in each cell from 'windows form' or 'user interface'. Would be thankful to you if you could help me in this regard or if you could provide a code for this.
The code that you need to use to insert value in a cell would be similar to this:
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
.ApplyStyleRowBands = True
.ApplyStyleColumnBands = False
End With
Selection.TypeText Text:="asdasd"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.TypeText Text:="asdasd"