public static void SaveRowHeaderInfo(Worksheet sheet, CopyMoveCellsInfo headerCellsInfo, CopyMoveRowsInfo rowsInfo, int baseRow, CopyToOption option) { if ((option & CopyToOption.All) > ((CopyToOption)0)) { int rowCount = headerCellsInfo.RowCount; int columnCount = headerCellsInfo.ColumnCount; for (int i = 0; i < rowCount; i++) { for (int k = 0; k < columnCount; k++) { if ((option & CopyToOption.Value) > ((CopyToOption)0)) { headerCellsInfo.SaveValue(i, k, sheet.GetValue(baseRow + i, k, SheetArea.CornerHeader | SheetArea.RowHeader)); } if ((option & CopyToOption.Style) > ((CopyToOption)0)) { headerCellsInfo.SaveStyle(i, k, GetStyleObject(sheet, baseRow + i, k, SheetArea.CornerHeader | SheetArea.RowHeader)); } if ((option & CopyToOption.Tag) > ((CopyToOption)0)) { headerCellsInfo.SaveTag(i, k, sheet.GetTag(baseRow + i, k, SheetArea.CornerHeader | SheetArea.RowHeader)); } } } if ((option & CopyToOption.Span) > ((CopyToOption)0)) { IEnumerator enumerator = sheet.RowHeaderSpanModel.GetEnumerator(baseRow, 0, rowCount, columnCount); while (enumerator.MoveNext()) { headerCellsInfo.SaveSpan((CellRange)enumerator.Current); } } rowCount = rowsInfo.RowCount; for (int j = 0; j < rowCount; j++) { rowsInfo.SaveHeight(j, sheet.GetRowHeight(baseRow + j)); rowsInfo.SaveVisible(j, sheet.GetRowVisible(baseRow + j)); rowsInfo.SaveResizable(j, sheet.GetRowResizable(baseRow + j)); rowsInfo.SaveTag(j, sheet.GetTag(baseRow + j, -1)); } if ((option & CopyToOption.Style) > ((CopyToOption)0)) { for (int m = 0; m < rowCount; m++) { rowsInfo.SaveViewportRowStyle(m, GetStyleObject(sheet, baseRow + m, -1, SheetArea.Cells)); rowsInfo.SaveHeaderRowStyle(m, GetStyleObject(sheet, baseRow + m, -1, SheetArea.CornerHeader | SheetArea.RowHeader)); } } if ((option & CopyToOption.RangeGroup) > ((CopyToOption)0)) { RangeGroup rowRangeGroup = sheet.RowRangeGroup; if ((rowRangeGroup != null) && !rowRangeGroup.IsEmpty()) { for (int n = 0; n < rowCount; n++) { rowsInfo.SaveRangeGroup(n, rowRangeGroup.Data.GetLevel(baseRow + n), rowRangeGroup.Data.GetCollapsed(baseRow + n)); } } } } }
public static void SaveColumnHeaderInfo(Worksheet sheet, CopyMoveCellsInfo headerCellsInfo, CopyMoveColumnsInfo columnsInfo, int baseColumn, CopyToOption option) { int rowCount = headerCellsInfo.RowCount; int columnCount = headerCellsInfo.ColumnCount; for (int i = 0; i < rowCount; i++) { for (int k = 0; k < columnCount; k++) { if ((option & CopyToOption.Value) > ((CopyToOption)0)) { headerCellsInfo.SaveValue(i, k, sheet.GetValue(i, baseColumn + k, SheetArea.ColumnHeader)); } if ((option & CopyToOption.Style) > ((CopyToOption)0)) { headerCellsInfo.SaveStyle(i, k, GetStyleObject(sheet, i, baseColumn + k, SheetArea.ColumnHeader)); } if ((option & CopyToOption.Tag) > ((CopyToOption)0)) { headerCellsInfo.SaveTag(i, k, sheet.GetTag(i, baseColumn + k, SheetArea.ColumnHeader)); } } } if ((option & CopyToOption.Value) > ((CopyToOption)0)) { for (int m = 0; m < columnCount; m++) { if (sheet.IsColumnBound(baseColumn + m)) { columnsInfo.SaveBindingField(m, sheet.GetDataColumnName(baseColumn + m)); } } } if ((option & CopyToOption.Span) > ((CopyToOption)0)) { IEnumerator enumerator = sheet.ColumnHeaderSpanModel.GetEnumerator(0, baseColumn, rowCount, columnCount); while (enumerator.MoveNext()) { headerCellsInfo.SaveSpan((CellRange)enumerator.Current); } } columnCount = columnsInfo.ColumnCount; for (int j = 0; j < columnCount; j++) { columnsInfo.SaveWidth(j, sheet.GetColumnWidth(baseColumn + j)); columnsInfo.SaveVisible(j, sheet.GetColumnVisible(baseColumn + j)); columnsInfo.SaveResizable(j, sheet.GetColumnResizable(baseColumn + j)); columnsInfo.SaveTag(j, sheet.GetTag(-1, baseColumn + j)); } if ((option & CopyToOption.Style) > ((CopyToOption)0)) { for (int n = 0; n < columnCount; n++) { columnsInfo.SaveViewportColumnStyle(n, GetStyleObject(sheet, -1, baseColumn + n, SheetArea.Cells)); columnsInfo.SaveHeaderColumnStyle(n, GetStyleObject(sheet, -1, baseColumn + n, SheetArea.ColumnHeader)); } } if ((option & CopyToOption.RangeGroup) > ((CopyToOption)0)) { RangeGroup columnRangeGroup = sheet.ColumnRangeGroup; if ((columnRangeGroup != null) && !columnRangeGroup.IsEmpty()) { for (int num8 = 0; num8 < columnCount; num8++) { columnsInfo.SaveRangeGroup(num8, columnRangeGroup.Data.GetLevel(baseColumn + num8), columnRangeGroup.Data.GetCollapsed(baseColumn + num8)); } } } }