Esempio n. 1
0
        void TEPMethod(DataTable table,
                       List <int> listColumnsNumber,
                       List <int> listtmplNumber,
                       INodeBilder tableNode,
                       string typetable,
                       string typeChannel,
                       string interval)
        {
            for (int j = 0, tableRowsCount = table.Rows.Count; j < tableRowsCount; j++)
            {
                var elem = table.Rows[j];
                mainBilder.AddParamValues(elem.Field <string>(listColumnsNumber[3]));
            }
            foreach (int i in listtmplNumber)
            {
                var colName  = table.Columns[i].ColumnName;
                var tmplNode = tableNode.AddNode(colName, typetable)
                               .AddProperty("interval", "[UTC+03]=1d")
                               .AddProperty("sortindex", tableNode.GetNodesNumber().ToString());

                foreach (DataRow row in table.Rows)
                {
                    if (row.Field <string>(i) == "+")
                    {
                        var chanNode = tmplNode
                                       .AddNode(row.Field <string>(listColumnsNumber[1]), typeChannel)
                                       .AddProperty("formula_cod", row.Field <string>(listColumnsNumber[3]) + "," + colName + "," + interval)
                                       .AddProperty("formula_text", ReplaceTex.SetNameAndInterval(row.Field <string>(listColumnsNumber[4]), colName, interval))
                                       .AddProperty("index", row.Field <string>(listColumnsNumber[0]))
                                       .AddProperty("sortindex", tmplNode.GetNodesNumber().ToString());
                    }
                }
            }
        }
Esempio n. 2
0
        public void EnterSimbol()
        {
            const string Str = @"q_4^исх+〖Δq〗_4^исх (А^р )+〖Δq〗_4^исх (W^р);";

            string asserttxt = ReplaceTex.EnterSimbol(Str);

            Console.WriteLine(asserttxt);
            StringAssert.Contains(@"$q_4\^исх$+$\Delta q_4\^исх (А\^р )$+$\Delta q_4\^исх (W\^р)$;", asserttxt);
        }
Esempio n. 3
0
        public void ReplaceText()
        {
            const string Str = @"(t_(ух,(уг)i)^н∙Q ̅_к(уг)i^бр+t_(ух,(г)i)^н∙Q ̅_к(г)i^бр)/Q ̅_кi^бр;";

            string enterstr  = ReplaceTex.EnterSimbol(Str);
            string asserttxt = ReplaceTex.CleanedTex(enterstr);

            Console.WriteLine(asserttxt);
            StringAssert.Contains(
                @"($t^н_{ух,(уг)i}$*$\bar Q^бр_{к(уг)i}$+$t^н_{ух,(г)i}$*$\bar Q^бр)_{к(г)i}$/$\bar Q^бр_{кi}$;",
                asserttxt);
        }
Esempio n. 4
0
 public DataTable TableCleanTex(DataTable tbl, List <int> columnNumber)
 {
     foreach (DataRow row in tbl.Rows)
     {
         for (int i = 0; i < tbl.Columns.Count; i++)
         {
             var str = new StringBuilder(ReplaceTex.CleanedTex(row[i].ToString()));
             row[i] = i != columnNumber.Last() ? str.Replace("$", "").ToString() : str.ToString();
         }
     }
     return(tbl);
 }
Esempio n. 5
0
        public Task <DataTable> GetTable(int tbl, string _filename)
        {
            return(Task.Run(() => {
                GetTableArrayProgress(0, 100);
                var dataTableForReturn = new DataTable();
                using (WordprocessingDocument myDocument = WordprocessingDocument.Open(_filename, false)) {
                    DocumentFormat.OpenXml.Wordprocessing.Table tabl =
                        myDocument.MainDocumentPart.Document.Body
                        .Elements <DocumentFormat.OpenXml.Wordprocessing.Table>().ElementAt(tbl);
                    if (tabl != null)
                    {
                        int rowNumber = tabl.Elements <TableRow>().Count();

                        for (int i = 0; i < rowNumber; i++)
                        {
                            DataRow nrow = null;
                            int coumnNumber = tabl.Elements <TableRow>().ElementAt(i).Elements <TableCell>().Count();
                            if (i > 0)
                            {
                                nrow = dataTableForReturn.NewRow();
                            }
                            for (int j = 0; j < coumnNumber; j++)
                            {
                                string cell = tabl.Elements <TableRow>().ElementAt(i).Elements <TableCell>().ElementAt(j).InnerText.Trim(' ');
                                if (i == 0)
                                {
                                    dataTableForReturn.Columns.Add(cell);
                                    continue;
                                }
                                if (dataTableForReturn.Columns.Count < coumnNumber)
                                {
                                    dataTableForReturn.Columns.Add(cell);
                                }
                                if (nrow != null)
                                {
                                    nrow[j] = ReplaceTex.EnterSimbol(cell);
                                }
                            }
                            if (nrow != null)
                            {
                                dataTableForReturn.Rows.Add(nrow);
                            }
                            GetTableArrayProgress(i, rowNumber);
                        }
                    }
                }
                return dataTableForReturn;
            }));
        }