Skip to content

Commit

Permalink
Refactor pane load
Browse files Browse the repository at this point in the history
  • Loading branch information
igitur committed Dec 16, 2020
1 parent 8c8c27b commit defc96c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ClosedXML/Excel/XLWorkbook_Load.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3009,15 +3009,13 @@ private static void LoadSheetViews(SheetViews sheetViews, XLWorksheet ws)
ws.SheetView.ZoomScaleSheetLayoutView = (int)UInt32Value.ToUInt32(sheetView.ZoomScaleSheetLayoutView);

var pane = sheetView.Elements<Pane>().FirstOrDefault();
if (pane == null) return;

if (pane.State == null ||
(pane.State != PaneStateValues.FrozenSplit && pane.State != PaneStateValues.Frozen)) return;

if (pane.HorizontalSplit != null)
ws.SheetView.SplitColumn = (Int32)pane.HorizontalSplit.Value;
if (pane.VerticalSplit != null)
ws.SheetView.SplitRow = (Int32)pane.VerticalSplit.Value;
if (new[] { PaneStateValues.Frozen, PaneStateValues.FrozenSplit }.Contains(pane?.State?.Value ?? PaneStateValues.Split))
{
if (pane.HorizontalSplit != null)
ws.SheetView.SplitColumn = (Int32)pane.HorizontalSplit.Value;
if (pane.VerticalSplit != null)
ws.SheetView.SplitRow = (Int32)pane.VerticalSplit.Value;
}
}

private void SetProperties(SpreadsheetDocument dSpreadsheet)
Expand Down

0 comments on commit defc96c

Please sign in to comment.