public void CanGetCell() { using (var doc = WordprocessingDocument.Open(TemplatePath, false)) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = table.Cell(1, 1); Assert.IsNotNull(cell); } }
public void GetCellText() { using (var doc = WordprocessingDocument.Open(TemplatePath, false)) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = table.Cell(3, 2); var txt = cell.Text; Assert.AreEqual(txt, "TextInColumn"); } }
public void CopyRow() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); table.Rows.Copy(); var cell = table.Cell(4, 2); Assert.AreEqual(cell.Text, "TextInColumn"); } }
public void CanAddRow() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); table.Rows.Add(); var cell = table.Cell(4, 2); Assert.IsNotNull(cell); } }
public void GetCopyOfTableToTable() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var destTable = new WordDocumentTable(doc); destTable.Select("TableForCopy"); var sourceTable = new WordDocumentTable(doc); sourceTable.Select("Table2"); sourceTable.GetCopyOf(destTable); Assert.AreEqual(sourceTable.Cell(5, 1).Text, "Вид инструктажа"); } }
public void CopyTableToTable() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var destTable = new WordDocumentTable(doc); destTable.Select("TableForCopy"); var sourceTable = new WordDocumentTable(doc); sourceTable.Select("Table2"); sourceTable.CopyTo(destTable); Assert.AreEqual(destTable.Cell(9, 1).Text, "Годен\r\nЗдоров\r\nМолод"); } }
public void CanCopyRowByIndex() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); var rows = new WordDocumentTableRows(table); rows.CopyRow(2); var cell = table.Cell(4, 3); Assert.AreEqual(cell.Text, "Количество"); } }
public void SetCellText() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = table.Cell(3, 2); const string val = "New Text"; cell.Text = val; Assert.AreEqual(cell.Text, val); } }