K
Kevin993
Guest
Greetings,
I have a DGV with 7 columns and some rows (not always a fixed number of rows) , I also have a word template .docx which also contains a table with 7 columns and one single empty row. I set a bookmark point to each cell of the table in word file accordingly (7 bookmarks on the whole). I use the code below to add value of onc cell in DGV to a bookmark point in word document :
Dim Fword As Word.Application
Dim Fdoc As Word.Document
Fword = CreateObject("Word.Application")
Fword.Visible = False
Fword.Application.DisplayAlerts = False
Fdoc = Fword.Documents.Add(Application.StartupPath & "\MyTemplate.docx")
Fdoc.Bookmarks.Item("P1").Range.Text = DataGridView1.Rows(0).Cells(0).Value.ToString
If there is only one row in DGV , that would be fine to add the row to table in word , because my table has one empty row. But what if there are numerous rows ? I want word to add rows to its table in accordance with DGV rows.
I would be thankful if you help me out.
Continue reading...
I have a DGV with 7 columns and some rows (not always a fixed number of rows) , I also have a word template .docx which also contains a table with 7 columns and one single empty row. I set a bookmark point to each cell of the table in word file accordingly (7 bookmarks on the whole). I use the code below to add value of onc cell in DGV to a bookmark point in word document :
Dim Fword As Word.Application
Dim Fdoc As Word.Document
Fword = CreateObject("Word.Application")
Fword.Visible = False
Fword.Application.DisplayAlerts = False
Fdoc = Fword.Documents.Add(Application.StartupPath & "\MyTemplate.docx")
Fdoc.Bookmarks.Item("P1").Range.Text = DataGridView1.Rows(0).Cells(0).Value.ToString
If there is only one row in DGV , that would be fine to add the row to table in word , because my table has one empty row. But what if there are numerous rows ? I want word to add rows to its table in accordance with DGV rows.
I would be thankful if you help me out.
Continue reading...