Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        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));
            }
        }
Esempio n. 3
0
        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);
 }
Esempio n. 5
0
        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");
            }
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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");
            }
        }