public void CanSelectCell() { using (var doc = WordprocessingDocument.Open(TemplatePath, false)) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = new WordDocumentTableCell(table.Table); Assert.IsTrue(cell.Select(1, 1)); } }
public void GetTableEmptyCellText() { using (var doc = WordprocessingDocument.Open(TemplatePath, false)) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = new WordDocumentTableCell(table.Table); cell.Select(3, 1); var txt = cell.Text; Assert.IsTrue(string.IsNullOrEmpty(txt)); } }
public void GetTableCellText() { using (var doc = WordprocessingDocument.Open(TemplatePath, false)) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = new WordDocumentTableCell(table.Table); cell.Select(3, 2); var txt = cell.Text; Assert.AreEqual(txt, "TextInColumn"); } }
private bool TryGetCell(int rowNum, int colNum, out IWordDocumentTableCell tableCell) { if (Table != null) { var cell = new WordDocumentTableCell(this); if (cell.Select(rowNum, colNum)) { tableCell = cell; return(true); } } tableCell = null; return(false); }
public void GetTableCellProperties() { using (var doc = WordprocessingDocument.Open(TemplatePath, false)) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = new WordDocumentTableCell(table.Table); cell.Select(1, 1); var cp = (TableCellProperties)cell.CellProperties; Assert.IsNotNull(cp); Assert.AreEqual(cp.TableCellWidth.Width.ToString(), "4809"); } }
public void SetTableCellText() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = new WordDocumentTableCell(table.Table); cell.Select(3, 2); const string val = "New Text"; cell.Text = val; Assert.AreEqual(cell.Text, val); } }
public void SetTableCellProperties() { using (var doc = WordprocessingDocument.Open(TemplatePath, true, new OpenSettings { AutoSave = false })) { var table = new WordDocumentTable(doc); table.Select("Table1"); var cell = new WordDocumentTableCell(table.Table); cell.Select(1, 1); var ncp = new TableCellProperties( new TableCellWidth { Type = TableWidthUnitValues.Dxa, Width = "2400" }); cell.CellProperties = ncp; var cp = (TableCellProperties)cell.CellProperties; Assert.IsNotNull(cp); Assert.AreEqual(cp.TableCellWidth.Width.ToString(), "2400"); } }