예제 #1
0
        public void UpdateCells()
        {
            int           row   = 0;
            S8Spreadsheet sheet = (S8Spreadsheet)this.SelectedVariable.Value;

            foreach (DataRow dRow in this.dataSheet.Rows)
            {
                for (int col = 0; col < dataSheet.Columns.Count; col++)
                {
                    sheet.GetCell(row + 1, col + 1).Value = dRow[col].ToString();
                }

                row++;
            }

            this.HasUpdates = false;
        }
예제 #2
0
        public void Update(Variable source, Variable destination)
        {
            S8Spreadsheet sourceSheet      = (S8Spreadsheet)source.Value;
            S8Spreadsheet destinationSheet = (S8Spreadsheet)destination.Value;

            foreach (S8Spreadsheet.Cell cell in sourceSheet)
            {
                try{
                    S8Spreadsheet.Cell toUpdate = destinationSheet.GetCell(cell.Row, cell.Col);
                    toUpdate.Value = cell.Value;
                }catch (ArgumentOutOfRangeException) {
                    destinationSheet.Cells.Add(new S8Spreadsheet.Cell()
                    {
                        Row = cell.Row, Col = cell.Col, Value = cell.Value
                    });
                }
            }

            destination.Value = destinationSheet;
        }