Ejemplo n.º 1
0
 internal void CompareWithGoodColumns(ColumnHeaderValue columnHeader)
 {
     foreach (var item in GoodColumns)
     {
         var percent = (float)Math.Round((new MatchsMaker(item.Name, columnHeader.Caption)).Score * 100);
         if (Math.Abs(percent) < 0.01F)
         {
             percent = 0.01F;
         }
         columnHeader.GoodColumnWithPercentMatches.Add(new GoodColumnWithPercentMathces {
             GoodColumnId = item.Id, GoodColumnName = item.Name, Percent = percent
         });
         if (percent <= columnHeader.BestValue.Percent)
         {
             continue;
         }
         columnHeader.BestValue.Percent        = percent;
         columnHeader.BestValue.GoodColumnId   = item.Id;
         columnHeader.BestValue.GoodColumnName = item.Name;
     }
     columnHeader.GoodColumnWithPercentMatches.Sort((one, two) => { if (one.Percent > two.Percent)
                                                                    {
                                                                        return(-1);
                                                                    }
                                                                    else
                                                                    {
                                                                        return(1);
                                                                    } });
 }
Ejemplo n.º 2
0
        internal void ParseWorkSheet()
        {
            var headerTableFound = false;
            var usedRange        = WorkSheet.GetUsedRange();

            ColumnsCount = usedRange.RightColumnIndex - usedRange.LeftColumnIndex;

            for (var rowIndex = usedRange.TopRowIndex; rowIndex < usedRange.BottomRowIndex; rowIndex++)
            {
                AddNewRow();
                for (var columnIndex = usedRange.LeftColumnIndex; columnIndex <= usedRange.RightColumnIndex; columnIndex++)
                {
                    CurrentRowInfo.AddCell(WorkSheet.Cells[rowIndex, columnIndex]);
                }

                if (headerTableFound || !GetStatisticForRow())
                {
                    continue;
                }

                headerTableFound = true;
                for (var headerColumnIndex = usedRange.LeftColumnIndex; headerColumnIndex <= usedRange.RightColumnIndex; headerColumnIndex++)
                {
                    if (WorkSheet.Cells[rowIndex, headerColumnIndex].Value.Type != CellValueType.Text)
                    {
                        continue;
                    }
                    var cellValue   = WorkSheet.Cells[rowIndex, headerColumnIndex].Value.ToString().ToLower();
                    var columnRange = new Thickness {
                        Left = headerColumnIndex, Top = usedRange.TopRowIndex, Right = headerColumnIndex, Bottom = usedRange.BottomRowIndex
                    };

                    var pattern = new Regex("[:_,.\\*/\n]|[ ]{2,}");
                    cellValue = pattern.Replace(cellValue, " ");

                    var columnHeaderValue = new ColumnHeaderValue {
                        HeaderTableRowIndex = rowIndex, Caption = cellValue, RangeInWorksheet = columnRange
                    };

                    if (ColumnHeaderList.Exists(c => c.Caption == columnHeaderValue.Caption))
                    {
                        continue;
                    }
                    CompareWithGoodColumns(columnHeaderValue);
                    ColumnHeaderList.Add(columnHeaderValue);
                }
            }
        }
Ejemplo n.º 3
0
        internal void ParseWorkSheet()
        {
            var headerTableFound = false;
            var usedRange = WorkSheet.GetUsedRange();
            ColumnsCount = usedRange.RightColumnIndex - usedRange.LeftColumnIndex;

            for (var rowIndex = usedRange.TopRowIndex; rowIndex < usedRange.BottomRowIndex; rowIndex++)
            {
                AddNewRow();
                for (var columnIndex = usedRange.LeftColumnIndex; columnIndex <= usedRange.RightColumnIndex; columnIndex++)
                    CurrentRowInfo.AddCell(WorkSheet.Cells[rowIndex, columnIndex]);

                if (headerTableFound || !GetStatisticForRow())
                    continue;

                headerTableFound = true;
                for (var headerColumnIndex = usedRange.LeftColumnIndex; headerColumnIndex <= usedRange.RightColumnIndex; headerColumnIndex++)
                {
                    if (WorkSheet.Cells[rowIndex, headerColumnIndex].Value.Type != CellValueType.Text)
                        continue;
                    var cellValue = WorkSheet.Cells[rowIndex, headerColumnIndex].Value.ToString().ToLower();
                    var columnRange = new Thickness { Left = headerColumnIndex, Top = usedRange.TopRowIndex, Right = headerColumnIndex, Bottom = usedRange.BottomRowIndex };

                    var pattern = new Regex("[:_,.\\*/\n]|[ ]{2,}");
                    cellValue = pattern.Replace(cellValue, " ");

                    var columnHeaderValue = new ColumnHeaderValue { HeaderTableRowIndex = rowIndex, Caption = cellValue, RangeInWorksheet = columnRange };

                    if (ColumnHeaderList.Exists(c => c.Caption == columnHeaderValue.Caption))
                        continue;
                    CompareWithGoodColumns(columnHeaderValue);
                    ColumnHeaderList.Add(columnHeaderValue);
                }
            }
        }
Ejemplo n.º 4
0
 internal void CompareWithGoodColumns(ColumnHeaderValue columnHeader)
 {
     foreach (var item in GoodColumns)
     {
         var percent = (float)Math.Round((new MatchsMaker(item.Name, columnHeader.Caption)).Score * 100);
         if (Math.Abs(percent) < 0.01F)
             percent = 0.01F;
         columnHeader.GoodColumnWithPercentMatches.Add(new GoodColumnWithPercentMathces { GoodColumnId = item.Id, GoodColumnName = item.Name, Percent = percent });
         if (percent <= columnHeader.BestValue.Percent)
             continue;
         columnHeader.BestValue.Percent = percent;
         columnHeader.BestValue.GoodColumnId = item.Id;
         columnHeader.BestValue.GoodColumnName = item.Name;
     }
     columnHeader.GoodColumnWithPercentMatches.Sort((one, two) => { if (one.Percent > two.Percent) return -1; else return 1; });
 }