Excel Interop set View style of worksheet to a normal view

Viewed 364

How do I change the view style of Excel Worksheet In Excel interop to a Normal style?

Like this:

enter image description here

Just have no idea :(

Does someone know?

1 Answers

i see just one solution, you have to use ActiveWindow.View: a sample to use it

        using Excel = Microsoft.Office.Interop.Excel;

        object missing = System.Reflection.Missing.Value;
        Excel.Application excel = new Excel.Application();

        Excel.Workbooks wbs = excel.Workbooks;

        Excel.Workbook wb = wbs.Open(@"d:\test.xlsm");
        Excel.Worksheet sheet = wb.ActiveSheet;

        // set the view style
        excel.ActiveWindow.View = XlWindowView.xlNormalView;

        object filename = @"d:\test1.xlsm";

        wb.SaveAs(filename);
        wbs.Close();
        excel.Quit();

if you have more Worksheets, you have to do that on each Worksheet...

Related