private Table AddTableWithNoColumnDefinitionToDocument(TextDocument document, string tableName) { //Lets add another table with no column definitions. var table = document.AddTable(tableName); //And two rows table.AddRow(new List <string>() { "Sonnet I", "Shakespeare" }); table.AddRow(new List <string>() { "Sonnet II", "Shakespeare" }); return(table); }
private Table AddLinearTableToDocument(TextDocument document, string tableName) { //Lets add a table var table = document.AddTable(tableName); //With two columns table.AddColumns(new List <string>() { "Title", "Author" }); //And two rows table.AddRow(new List <string>() { "Sonnet I", "Shakespeare" }); table.AddRow(new List <string>() { "Sonnet II", "Shakespeare" }); return(table); }
private Table AddTableWithDifferentNumberOfColumnsPerRowToDocument(TextDocument document, string tableName) { //Lets add another table with different number of columns per row. var table = document.AddTable(tableName); //With two columns table.AddColumns(new List <string>() { "Title", "Author" }); //And two rows table.AddRow(new List <string>() { "Sonnet I", "Shakespeare" }); table.AddRow(new List <string>() { "Sonnet II", "Shakespeare", "William" }); return(table); }
public void AddTable() { //Lets add a table var table = _document.AddTable("Table 1"); Assert.NotNull(table); //With two columns table.AddColumns(new List <string>() { "col 1", "col 2" }); //And two rows table.AddRow(new List <string>() { "row 1 col 1", "row 1 col 2" }); table.AddRow(new List <string>() { "row 2 col 1", "row 2 col 2" }); Assert.True(_document.Paragraphs.Count == 1, "Table not added to the document"); Assert.True(table.ColCount == 2, "Number of columns is incorrect"); Assert.True(table.RowCount == 2, "Number of rows is incorrect"); Assert.True(table.Text == "Table 1", "Table name not correct"); Assert.True(table.Col[0] == "col 1", "The text of column 1 is not correct"); Assert.True(table.Col[1] == "col 2", "The text of column 2 is not correct"); Assert.True(table.Row[0][0] == "row 1 col 1", "The text of row 1 in column 1 is not correct"); Assert.True(table.Row[0][1] == "row 1 col 2", "The text of row 1 in column 2 is not correct"); Assert.True(table.Row[1][0] == "row 2 col 1", "The text of row 2 in column 1 is not correct"); Assert.True(table.Row[1][1] == "row 2 col 2", "The text of row 2 in column 2 is not correct"); Assert.Same(table, _document.Paragraphs[0]); }