Exemplo n.º 1
0
        private void CompareSheet(string leftSheetName, string rightSheetName)
        {
            ClearAlignment();
            currentSheet = new SheetComparer();
            currentSheet.Execute(leftWorkbook.LoadSheet(leftSheetName), rightWorkbook.LoadSheet(rightSheetName));
            stopUpdate = true;

            leftGrid.DataSource  = currentSheet.left.GetSource();
            rightGrid.DataSource = currentSheet.right.GetSource();
            stopUpdate           = false;

            lineTable = new DataTable();

            for (int i = 0; i < currentSheet.columnCount; i++)
            {
                lineTable.Columns.Add(new DataColumn(CellReference.ConvertNumToColString(i)));
            }

            rowDiffGrid.DataSource = lineTable;

            UpdateNextPreviousButton();
            AdjustRowHeaderSize();
            compareToolStripButton.Enabled = false;
            UpdateGridViewFocus();
            differenceScrollBar.ForceUpdate();
            differenceScrollBar.Selection = -1;
        }
Exemplo n.º 2
0
        private void CompareWithAlignment()
        {
            int leftRowIndex = leftGrid.FirstDisplayedScrollingRowIndex;

            leftGrid.Cursor  = Cursors.Default;
            rightGrid.Cursor = Cursors.Default;
            SheetComparer sheetComparer = new SheetComparer();

            sheetComparer.Execute(currentSheet.left, currentSheet.right, _leftAlignIndex, _rightAlignIndex);
            stopUpdate = true;

            currentSheet = sheetComparer;

            int visibleRow = Math.Min(_leftAlignIndex, _rightAlignIndex);

            _leftAlignIndex  = -1;
            _rightAlignIndex = -1;

            leftGrid.DataSource  = currentSheet.left.GetSource();
            rightGrid.DataSource = currentSheet.right.GetSource();
            stopUpdate           = false;

            lineTable = new DataTable();

            for (int i = 0; i < currentSheet.columnCount; i++)
            {
                lineTable.Columns.Add(new DataColumn(CellReference.ConvertNumToColString(i)));
            }

            rowDiffGrid.DataSource = lineTable;

            if (visibleRow != -1)
            {
                JumpToRow(visibleRow);
            }
            else
            {
                UpdateNextPreviousButton();
            }

            leftGrid.FirstDisplayedScrollingRowIndex = leftRowIndex;
            UpdateGridViewFocus();
            differenceScrollBar.ForceUpdate();
        }