using System;
using Docs.Word;


namespace SampleManager
{
	class Tables_NestedTable
	{
		internal static Document Main1()
		{
			//	Create a new document
			Document Doc = Document.CreateNew();

			//	Create a table and add one paragraph to each of table cells
			Table tTable1 = 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
			Table tTable2 = 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\r");

			return Doc;
		}
	}
}
