Other API Samples

Live SpreadsheetGear API Samples

Workbook Miscellaneous Workbook and Worksheet Windows

SpreadsheetGear supports specifying multiple "windows" on a workbook, similar in Excel from the Ribbon > View Tab > New Window. Each window can have its own unique display options, such as showing or hiding the tab bar and scrollbars; or for each worksheet displaying different scroll locations, split or frozen panes, etc.

// Create a new workbook
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook();

// Add some data to the worksheet
workbook.ActiveWorksheet.Cells["A1"].Value = "Hello World!";

// Create a new window.
workbook.WindowInfos.Add();

// Modify some options on the first window for the workbook and the active sheet.
SpreadsheetGear.IWorkbookWindowInfo wbWindow1 = workbook.WindowInfos[0];
SpreadsheetGear.IWorksheetWindowInfo wsWindow1 = workbook.ActiveWorksheet.WindowInfos[0];
wbWindow1.DisplayWorkbookTabs = false;
wsWindow1.DisplayHeadings = false;

// Modify some other options on the second window.
SpreadsheetGear.IWorkbookWindowInfo wbWindow2 = workbook.WindowInfos[1];
SpreadsheetGear.IWorksheetWindowInfo wsWindow2 = workbook.ActiveWorksheet.WindowInfos[1];
wbWindow1.DisplayVerticalScrollBar = false;
wbWindow1.DisplayHorizontalScrollBar = false;
wsWindow1.DisplayGridlines = false;
Run This Sample
Download File

Download an Excel Open XML Workbook (*.xlsx) file with the results of this sample.