Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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");
            }
        }
Exemple #3
0
        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");
            }
        }
Exemple #4
0
        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, "Количество");
            }
        }
Exemple #8
0
        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);
            }
        }