Imports Docs.Word



Public Class Tables_NestedTable
	Friend Shared Function Main1() As Document
		'	Create a new document
		Dim Doc As Document = Document.CreateNew()

		'	Create a table and add one paragraph to each of table cells
        Dim tTable1 As New Table(2, 2, 1)
		tTable1.AddNode(0, 0, New Paragraph("Paragraph 1"))
		tTable1.AddNode(0, 1, New Paragraph("Paragraph 2"))
		tTable1.AddNode(1, 0, New Paragraph("Paragraph 3"))
		tTable1.AddNode(1, 1, New Paragraph("Paragraph 4"))

		'	Create another table and add one paragraph to each of table cells
        Dim tTable2 As New Table(2, 2, 1)
		tTable2.AddParagraph(0, 0, "111")
		tTable2.AddParagraph(0, 1, "222")
		tTable2.AddParagraph(1, 0, "333")
		tTable2.AddParagraph(1, 1, "444")

		'	Nest second table into second cell of second row of first table
		tTable1.Rows(1).Cells(1).AddTable(tTable2)

		'	Insert result (first) table into document
		Doc.AddNode(tTable1)
		Doc.AddParagraph("2323" & vbCr)

		Return Doc
	End Function
End Class
