Example #1
0
        public void AddTable()
        {
            try
            {

                OXMLDocWrap doc = new OXMLDocWrap();
                doc.OpenDocument(@"..\..\test\TestModule.docx");

                OXMLTableStyleWrap tStyle = doc.TableStyles.Find(x => x.StyleID =="a5");
                OXMLTableWrap table = new OXMLTableWrap(4, 7, tStyle, null);

                table.GetCell(2, 2).TextAlignmentV = TextAlignmentVert.Bottom;
                table.GetCell(2, 2).paragraph.TextAlignmentH = TextAlignmentHoriz.Right;
                table.GetCell(2, 2).paragraph.AddText("YES");

                table.Rows[1].Height = 2.5F;
                table.Columns[1].Width = 2.5F;

                //if (table.CountColumns != 4) Assert.Fail("Count columns failt: " + table.CountColumns);
                //if (table.CountRows != 4) Assert.Fail("Count Rows failt: " + table.CountRows);

                //table.SetRowHeight(1, 2);
                //table.SetColumnWidth(1, 3);

                doc.AddTable(table);

                doc.CloseDocument();

            } catch (Exception e)
            {
                Assert.Fail("EXCEPT: " + e.Message);
            }

            Assert.Pass();
        }
Example #2
0
 public OXMLTableCellWrap(OXMLTableWrap table, int ColumnNumber, int RowNumber)
 {
     TableRow row = table.XMLTable.Elements<TableRow>().ElementAt(RowNumber);
     TableCell cell = row.Elements<TableCell>().ElementAt(ColumnNumber);
     paragraph = new OXMLParagraphWrap(cell.Elements<Paragraph>().First());
     margins = new OXMLTableCellMarginsWrap(this);
 }
Example #3
0
        public void TestMathFormulaWithRef()
        {
            try
            {

                OXMLDocWrap doc = new OXMLDocWrap();
                doc.OpenDocument(@"..\..\test\TestModule.docx");

                    OXMLTableWrap table = new OXMLTableWrap(2, 1, doc.TableStyles.Find(x => x.StyleID =="a5"), null);

                    table.Rows[0].setHeightWithRule(2, OXMLHeightRuleValues.Auto);

                    table.GetCell(0, 0).paragraph.TextAlignmentH = TextAlignmentHoriz.Center;
                    table.GetCell(1, 0).paragraph.TextAlignmentH = TextAlignmentHoriz.Center;

                    table.Columns[0].Width = 16.0f;
                    table.Columns[1].Width = 1.0f;

                    table.GetCell(0, 0).margins.LeftMargin = 12;
                    doc.AddMathFormulaToParagraph(table.GetCell(0, 0).paragraph, @"F=\SUP((\FRAC(1)(2)))(4)+1");

                    table.GetCell(1, 0).paragraph.AddText("(1)");

                    var param = new OXMLTableBorderParam();
                    param.bVal = "None";
                    param.bColor = "auto";
                    param.bSpace = 0;
                    param.bSize = 0;

                    table.borders.AllBorders = param;
                    doc.AddTable(table);

                doc.CloseDocument();

            } catch (Exception e)
            {
                Assert.Fail("EXCEPT: " + e.Message);
            }

            Assert.Pass();
        }
Example #4
0
 //------------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Добавление таблицы
 /// </summary>
 /// <param name="InternalTableName">Внутреннее имя таблицы</param>
 /// <param name="ColumnCount">Количество колонок</param>
 /// <param name="RowCount">Количество строк</param>
 public void Add_Table(string InternalTableName, int ColumnCount, int RowCount)
 {
     OXMLTableWrap table = new OXMLTableWrap(ColumnCount, RowCount, TableNormalStyle, null);
     TablesList.Add(InternalTableName, table);
 }
Example #5
0
        /// <summary>
        /// Добавление формулы с ссылкой
        /// </summary>
        /// <param name="text">Формула</param>
        /// <param name="ReferenceStr">Ссылка формулы</param>
        public void Add_TechFormulaWithReference(string text, string ReferenceStr)
        {
            OXMLTableWrap table = new OXMLTableWrap(2, 1, TableNormalStyle, null);

            table.GetCell(0, 0).paragraph.TextAlignmentH = TextAlignmentHoriz.Center;
            table.GetCell(1, 0).paragraph.TextAlignmentH = TextAlignmentHoriz.Center;

            table.Columns[0].Width = 16.0f;
            table.Columns[1].Width = 1.0f;

            table.GetCell(0, 0).margins.LeftMargin = 12;
            doc.AddMathFormulaToParagraph(table.GetCell(0, 0).paragraph, text);

            table.GetCell(1, 0).paragraph.AddText(ReferenceStr);

            var param = new OXMLTableBorderParam();	//убираем границы таблицы
            param.bVal = "None";
            param.bColor = "auto";
            param.bSpace = 0;
            param.bSize = 0;
            table.borders.AllBorders = param;

            doc.AddTable(table);
        }
Example #6
0
 public OXMLTableBorderWrap(OXMLTableWrap table)
 {
     _table = table;
 }