Beispiel #1
0
        public static void UndoColumnsInfo(Worksheet sheet, CopyMoveColumnsInfo columnsInfo, int baseColumn)
        {
            int columnCount = columnsInfo.ColumnCount;

            if (columnsInfo.IsBindingFieldSaved())
            {
                for (int i = 0; i < columnCount; i++)
                {
                    string str;
                    if (columnsInfo.GetBindingField(i, out str))
                    {
                        sheet.BindDataColumn(baseColumn + i, str);
                    }
                }
            }
            else
            {
                for (int j = 0; j < columnCount; j++)
                {
                    sheet.BindDataColumn(baseColumn + j, null);
                }
            }
            if (columnsInfo.IsWidthSaved())
            {
                for (int k = 0; k < columnCount; k++)
                {
                    sheet.SetColumnWidth(baseColumn + k, SheetArea.Cells, columnsInfo.GetWidth(k));
                }
            }
            if (columnsInfo.IsVisibleSaved())
            {
                for (int m = 0; m < columnCount; m++)
                {
                    sheet.SetColumnVisible(baseColumn + m, SheetArea.Cells, columnsInfo.GetVisible(m));
                }
            }
            if (columnsInfo.IsResizableSaved())
            {
                for (int n = 0; n < columnCount; n++)
                {
                    sheet.SetColumnResizable(baseColumn + n, SheetArea.Cells, columnsInfo.GetResizable(n));
                }
            }
            if (columnsInfo.IsTagSaved())
            {
                for (int num7 = 0; num7 < columnCount; num7++)
                {
                    sheet.SetTag(-1, baseColumn + num7, SheetArea.Cells, columnsInfo.GetTag(num7));
                }
            }
            if (columnsInfo.IsViewportColumnStyleSaved())
            {
                for (int num8 = 0; num8 < columnCount; num8++)
                {
                    SetStyleObject(sheet, -1, baseColumn + num8, SheetArea.Cells, columnsInfo.GetViewportColumnStyle(num8));
                }
            }
            if (columnsInfo.IsHeaderColumnStyleSaved())
            {
                for (int num9 = 0; num9 < columnCount; num9++)
                {
                    SetStyleObject(sheet, -1, baseColumn + num9, SheetArea.ColumnHeader, columnsInfo.GetHeaderColumnStyle(num9));
                }
            }
            if (columnsInfo.IsRangeGroupSaved())
            {
                RangeGroup columnRangeGroup = sheet.ColumnRangeGroup;
                if (columnRangeGroup != null)
                {
                    for (int num11 = 0; num11 < columnCount; num11++)
                    {
                        int  num10;
                        bool flag;
                        columnsInfo.GetRangeGroup(num11, out num10, out flag);
                        columnRangeGroup.Data.SetLevel(baseColumn + num11, num10);
                        columnRangeGroup.Data.SetCollapsed(baseColumn + num11, flag);
                    }
                }
            }
        }