Infragistics(R) NetAdvantage(R) WPF
WindowOptions Property
See Also  Example E-mail your feedback on this topic.
Infragistics.Excel Namespace > CustomView Class : WindowOptions Property

Gets the window options for the workbook associated with the custom view.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property WindowOptions As CustomViewWindowOptions
C# 
public CustomViewWindowOptions WindowOptions {get;}

Property Value

The window options for the workbook associated with the custom view..

Example

The following code demonstrates how to create, manipulate, and apply a custom view to a workbook.

Visual BasicCopy Code
Imports Infragistics.Excel

' Create a workbook with a worksheet
Dim workbook As New Workbook()
Dim worksheet1 As Worksheet = workbook.Worksheets.Add("Sheet1")

' Create two custom views: one which will have default settings and one which will have 
' different settings. The custom views are created with the current configuration of the 
' workbook and all worksheets, so each of the custom views created will have default 
' settings.
Dim defaultView As CustomView = workbook.CustomViews.Add("Default settings", True, True)
Dim alternateView As CustomView = workbook.CustomViews.Add("Alternate Settings", True, True)

' Change some window settings in the alternate view
alternateView.WindowOptions.ScrollBars = Infragistics.Excel.ScrollBars.None

' Get the display settings for the worksheet in the alternate settings view
Dim alternateDisplayOptions As CustomViewDisplayOptions = alternateView.GetDisplayOptions(worksheet1)

' Change some display options in the alternate view
alternateDisplayOptions.MagnificationInCurrentView = 200
alternateDisplayOptions.ShowRowAndColumnHeaders = False

' Get the print settings for the worksheet in the alternate settings view
Dim alternatePrintOptions As PrintOptions = alternateView.GetPrintOptions(worksheet1)

' Change some print options in the alternate view
alternatePrintOptions.Orientation = Infragistics.Excel.Orientation.Landscape
alternatePrintOptions.PrintErrors = PrintErrors.PrintAsDashes

' Get the collection of hidden rows for the worksheet in the alternate settings view
Dim hiddenRows As HiddenRowCollection = alternateView.GetHiddenRows(worksheet1)

' Hide some rows in the worksheet so when the custom view is applied, those rows will hide
hiddenRows.Add(worksheet1.Rows(2))
hiddenRows.Add(worksheet1.Rows(3))
hiddenRows.Add(worksheet1.Rows(4))

' Get the collection of hidden column for the worksheet in the alternate settings view
Dim hiddenColumns As HiddenColumnCollection = alternateView.GetHiddenColumns(worksheet1)

' Hide some columns in the worksheet so when the custom view is applied, those columns will hide
hiddenColumns.Add(worksheet1.Columns(2))
hiddenColumns.Add(worksheet1.Columns(4))

' Apply the alternate settings custom view
alternateView.Apply()
C#Copy Code
using System.Windows.Forms;
using Infragistics.Excel;

// Create a workbook with a worksheet
Workbook workbook = new Workbook();
Worksheet worksheet1 = workbook.Worksheets.Add( "Sheet1" );

// Create two custom views: one which will have default settings and one which will have 
// different settings. The custom views are created with the current configuration of the 
// workbook and all worksheets, so each of the custom views created will have default 
// settings.
CustomView defaultView = workbook.CustomViews.Add( "Default settings", true, true );
CustomView alternateView = workbook.CustomViews.Add( "Alternate Settings", true, true );

// Change some window settings in the alternate view
alternateView.WindowOptions.ScrollBars = Infragistics.Excel.ScrollBars.None;

// Get the display settings for the worksheet in the alternate settings view
CustomViewDisplayOptions alternateDisplayOptions = alternateView.GetDisplayOptions( worksheet1 );

// Change some display options in the alternate view
alternateDisplayOptions.MagnificationInCurrentView = 200;
alternateDisplayOptions.ShowRowAndColumnHeaders = false;

// Get the print settings for the worksheet in the alternate settings view
PrintOptions alternatePrintOptions = alternateView.GetPrintOptions( worksheet1 );

// Change some print options in the alternate view
alternatePrintOptions.Orientation = Infragistics.Excel.Orientation.Landscape;
alternatePrintOptions.PrintErrors = PrintErrors.PrintAsDashes;

// Get the collection of hidden rows for the worksheet in the alternate settings view
HiddenRowCollection hiddenRows = alternateView.GetHiddenRows( worksheet1 );

// Hide some rows in the worksheet so when the custom view is applied, those rows will hide
hiddenRows.Add( worksheet1.Rows[ 2 ] );
hiddenRows.Add( worksheet1.Rows[ 3 ] );
hiddenRows.Add( worksheet1.Rows[ 4 ] );

// Get the collection of hidden column for the worksheet in the alternate settings view
HiddenColumnCollection hiddenColumns = alternateView.GetHiddenColumns( worksheet1 );

// Hide some columns in the worksheet so when the custom view is applied, those columns will hide
hiddenColumns.Add( worksheet1.Columns[ 2 ] );
hiddenColumns.Add( worksheet1.Columns[ 4 ] );

// Apply the alternate settings custom view
alternateView.Apply();

Remarks

Setting properties on the returned Infragistics.Excel.CustomView.WindowOptions instance will not change the actual window options of the associated workbook. After setting properties, the Apply method of the CustomView will apply them to the workbook.

See Also

Reference

CustomView Class
CustomView Members
T:Workbook.WindowOptions