Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Feature request: Initial zoom of spreadsheet

$
0
0
I did implement it base on kbrimington suggetstion
__IXLSheetView.cs:__
/// <summary>
/// Window zoom magnification for current view representing percent values. Horizontal & Vertical scale together.
/// </summary>
/// <remarks>Representing percent values ranging from 10 to 400.</remarks>
Int32 ZoomScale { get; set; }
/// <summary>
/// Zoom magnification to use when in normal view. Horizontal & Vertical scale together
/// </summary>
/// <remarks>Representing percent values ranging from 10 to 400.</remarks>
Int32 ZoomScaleNormal { get; set; }
/// <summary>
/// Zoom magnification to use when in page layout view. Horizontal & Vertical scale together.
/// </summary>
/// <remarks>Representing percent values ranging from 10 to 400.</remarks>
Int32 ZoomScalePageLayoutView { get; set; }
/// <summary>
/// Zoom magnification to use when in page break preview. Horizontal & Vertical scale together.
/// </summary>
/// <remarks>Representing percent values ranging from 10 to 400.</remarks>
Int32 ZoomScaleSheetLayoutView { get; set; }


__XLSheetView.cs:__
private int _zoomScale { get; set; }
public int ZoomScale
{
    get { return _zoomScale; }
    set
    {
        _zoomScale = value;
        switch (View)
        {
            case XLSheetViewOptions.Normal:
                ZoomScaleNormal = value;
                break;
            case XLSheetViewOptions.PageBreakPreview:
                ZoomScalePageLayoutView = value;
                break;
            case XLSheetViewOptions.PageLayout:
                ZoomScaleSheetLayoutView = value;
                break;
        }
    }
}
public int ZoomScaleNormal { get; set; }
public int ZoomScalePageLayoutView { get; set; }
public int ZoomScaleSheetLayoutView { get; set; }

__XLWorkbook_Save.cs__
Function GenerateWorksheetPartContent
...
#region SheetViews
...
sheetView.ZoomScale = (UInt32)xlWorksheet.SheetView.ZoomScale;
sheetView.ZoomScaleNormal = (UInt32)xlWorksheet.SheetView.ZoomScaleNormal;
sheetView.ZoomScalePageLayoutView = (UInt32)xlWorksheet.SheetView.ZoomScalePageLayoutView;
sheetView.ZoomScaleSheetLayoutView = (UInt32)xlWorksheet.SheetView.ZoomScaleSheetLayoutView;
...

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>