using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace iDiTect.Excel.Demo
{
    public static class SheetViewHelper
    {
        public static void AddFreeze()
        {
            var workbook = new Workbook();
            var worksheet = workbook.Worksheets.Add("AddFreeze");

            //Freeze both column and row
            worksheet.SheetView.Freeze(3, 4);

            //Freeze only column
            //worksheet.SheetView.FreezeColumns(3);

            //Freeze only row
            //worksheet.SheetView.FreezeRows(4);
            
            workbook.Save("AddFreeze.xlsx");
        }

        public static void ZoomScale()
        {
            var workbook = new Workbook();
            var worksheet = workbook.Worksheets.Add("ZoomScale");
            worksheet.Cell("A1").Value = "Sample Text";

            //Set zoom scale for normal view
            worksheet.SheetView.ZoomScaleNormal = 150;
            //Set zoom scale for page layout view
            //worksheet.SheetView.ZoomScalePageLayoutView = 150;

            workbook.Save("ZoomScale.xlsx");
        }

        public static void HideSheet()
        {
            var workbook = new Workbook();

            //Hide sheet
            var worksheet = workbook.Worksheets.Add("HiddenSheet");
            worksheet.Hide();

            //Default is visible
            workbook.Worksheets.Add("VisibleSheet");

            //Unhide sheet
            workbook.Worksheets.Add("UnhideSheet").Hide().Unhide();

            //Add very hidden sheet
            workbook.Worksheets.Add("VeryHiddenSheet").Visibility = WorksheetVisibility.VeryHidden;

            //Unhide very hidden sheet
            var worksheet2 = workbook.Worksheets.Add("UnhideVeryHiddenSheet");
            worksheet2.Visibility = WorksheetVisibility.VeryHidden;
            worksheet2.Unhide();

            workbook.Save("HideSheet.xlsx");
        }

    }
}
