internal SLSelection Clone() { SLSelection s = new SLSelection(); s.Pane = this.Pane; s.ActiveCell = this.ActiveCell; s.ActiveCellId = this.ActiveCellId; s.SequenceOfReferences = new List <SLCellPointRange>(); foreach (SLCellPointRange pt in this.SequenceOfReferences) { s.SequenceOfReferences.Add(new SLCellPointRange(pt.StartRowIndex, pt.StartColumnIndex, pt.EndRowIndex, pt.EndColumnIndex)); } return(s); }
internal void FromSheetView(SheetView sv) { this.SetAllNull(); if (sv.WindowProtection != null) { this.WindowProtection = sv.WindowProtection.Value; } if (sv.ShowFormulas != null) { this.ShowFormulas = sv.ShowFormulas.Value; } if (sv.ShowGridLines != null) { this.ShowGridLines = sv.ShowGridLines.Value; } if (sv.ShowRowColHeaders != null) { this.ShowRowColHeaders = sv.ShowRowColHeaders.Value; } if (sv.ShowZeros != null) { this.ShowZeros = sv.ShowZeros.Value; } if (sv.RightToLeft != null) { this.RightToLeft = sv.RightToLeft.Value; } if (sv.TabSelected != null) { this.TabSelected = sv.TabSelected.Value; } if (sv.ShowRuler != null) { this.ShowRuler = sv.ShowRuler.Value; } if (sv.ShowOutlineSymbols != null) { this.ShowOutlineSymbols = sv.ShowOutlineSymbols.Value; } if (sv.DefaultGridColor != null) { this.DefaultGridColor = sv.DefaultGridColor.Value; } if (sv.ShowWhiteSpace != null) { this.ShowWhiteSpace = sv.ShowWhiteSpace.Value; } if (sv.View != null) { this.View = sv.View.Value; } if (sv.TopLeftCell != null) { this.TopLeftCell = sv.TopLeftCell.Value; } if (sv.ColorId != null) { this.ColorId = sv.ColorId.Value; } if (sv.ZoomScale != null) { this.ZoomScale = sv.ZoomScale.Value; } if (sv.ZoomScaleNormal != null) { this.ZoomScaleNormal = sv.ZoomScaleNormal.Value; } if (sv.ZoomScaleSheetLayoutView != null) { this.ZoomScaleSheetLayoutView = sv.ZoomScaleSheetLayoutView.Value; } if (sv.ZoomScalePageLayoutView != null) { this.ZoomScalePageLayoutView = sv.ZoomScalePageLayoutView.Value; } // required attribute but we'll use 0 as the default in case something terrible happens. if (sv.WorkbookViewId != null) { this.WorkbookViewId = sv.WorkbookViewId.Value; } else { this.WorkbookViewId = 0; } using (OpenXmlReader oxr = OpenXmlReader.Create(sv)) { SLSelection sel; while (oxr.Read()) { if (oxr.ElementType == typeof(Pane)) { this.Pane = new SLPane(); this.Pane.FromPane((Pane)oxr.LoadCurrentElement()); } else if (oxr.ElementType == typeof(Selection)) { sel = new SLSelection(); sel.FromSelection((Selection)oxr.LoadCurrentElement()); this.Selections.Add(sel); } else if (oxr.ElementType == typeof(PivotSelection)) { this.PivotSelections.Add((PivotSelection)oxr.LoadCurrentElement().CloneNode(true)); } } } }