I am working on creating an MS Excel 2013 report in which all worksheets in the workbook should have a freeze area in column 6 and line 1. I searched on Google, but could not find a solution, how to freeze the panel, the book should be active. I tried a lot, but did not succeed. I will be very grateful if someone can help me.
Excel.Application excel = new Excel.Application();
Excel.Workbook workbook = excel.Workbooks.Open("filelocation");
foreach (Excel.Worksheet ws in workbook.Worksheets)
{
ws.Application.ActiveWindow.SplitColumn = 6;
ws.Application.ActiveWindow.SplitRow = 1;
ws.Application.ActiveWindow.FreezePanes = true;
}
excel.Visible = true;
source
share