public void Move(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount) { this.MoveDataRange(fromRow, fromColumn, toRow, toColumn, rowCount, columnCount); DataMatrix <Sparkline> matrix = new DataMatrix <Sparkline>(rowCount, columnCount); for (int i = 0; i < rowCount; i++) { for (int k = 0; k < columnCount; k++) { Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + k); if (sparkline != null) { sparkline.Row = toRow + i; sparkline.Column = toColumn + k; matrix.SetValue(i, k, sparkline); } this.Sheet.SetSparkline(fromRow + i, fromColumn + k, null); } } for (int j = 0; j < rowCount; j++) { for (int m = 0; m < columnCount; m++) { this.Sheet.SetSparkline(toRow + j, toColumn + m, matrix.GetValue(j, m)); } } }
public void Copy(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount) { DataMatrix <Sparkline> matrix = new DataMatrix <Sparkline>(rowCount, columnCount); int offsetRow = toRow - fromRow; int offsetColumn = toColumn - fromColumn; for (int i = 0; i < rowCount; i++) { for (int k = 0; k < columnCount; k++) { Sparkline sparkline = this.Sheet.GetSparkline(fromRow + i, fromColumn + k); if (sparkline != null) { Sparkline sparkline2 = sparkline.Clone(); sparkline2.Row = toRow + i; sparkline2.Column = toColumn + k; CalcExpression dateAxisReference = sparkline2.DateAxisReference; if (dateAxisReference != null) { if (CanOffset(dateAxisReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount)) { sparkline2.DateAxisReference = dateAxisReference.Offset(offsetRow, offsetColumn, false, true); } else { sparkline2.DateAxisReference = new CalcErrorExpression(CalcErrors.Reference); } } CalcExpression dataReference = sparkline2.DataReference; if (dataReference != null) { if (CanOffset(dataReference, offsetRow, offsetColumn, ((Worksheet)this.Sheet).RowCount, ((Worksheet)this.Sheet).ColumnCount)) { sparkline2.DataReference = dataReference.Offset(offsetRow, offsetColumn, false, true); } else { sparkline2.DataReference = new CalcErrorExpression(CalcErrors.Reference); } } this.Add(sparkline2.Group); matrix.SetValue(i, k, sparkline2); } } } for (int j = 0; j < rowCount; j++) { for (int m = 0; m < columnCount; m++) { this.Sheet.SetSparkline(toRow + j, toColumn + m, matrix.GetValue(j, m)); } } }
void IRangeSupport.Move(int fromRow, int fromColumn, int toRow, int toColumn, int rowCount, int columnCount) { if (!this.isLoadingData && this.IsBound) { if (fromRow < 0) { fromRow = 0; rowCount = this.rowIndexes.Count; } if (fromRow > this.rowIndexes.Count) { fromRow = this.rowIndexes.Count; rowCount = 0; } if (fromColumn < 0) { fromColumn = 0; columnCount = this.fields.Length; } if (fromColumn > this.fields.Length) { fromColumn = this.fields.Length; columnCount = 0; } if (toRow < 0) { toRow = 0; } if (toRow > this.rowIndexes.Count) { toRow = this.rowIndexes.Count; } if (toColumn < 0) { toColumn = 0; } if (toColumn > this.fields.Length) { toColumn = this.fields.Length; } DataMatrix <object> matrix = new DataMatrix <object>(rowCount, columnCount); for (int i = 0; i < rowCount; i++) { for (int k = 0; k < columnCount; k++) { object obj2 = this.GetValue(fromRow + i, fromColumn + k); if (obj2 != null) { matrix.SetValue(i, k, obj2); } } } ((IRangeSupport)this).Clear(fromRow, fromColumn, rowCount, columnCount); for (int j = 0; j < rowCount; j++) { for (int m = 0; m < columnCount; m++) { this.SetValue(toRow + j, toColumn + m, matrix.GetValue(j, m)); } } } }