Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

Sets or returns the worksheet's

...

viewing

...

mode.

...

Signature
C#
C#
 public SheetViewState ViewState{ get; set; }
{signature}{signature:
}
Signature
vb.net
vb.net
Public Property ViewState() As SheetViewState
{signature}
{example}{code:csharp|title=C#}
Example
Code Block
csharp
csharp
titleC#

//--- Get ViewState
Worksheet.SheetViewState state = ws.ViewState;

//--- Set ViewState
ws.ViewState = Worksheet.SheetViewState.PageBreak;
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}

'--- Get ViewState
Dim state As Worksheet.SheetViewState = ws.ViewState

'--- Set ViewState
ws.ViewState = Worksheet.SheetViewState.PageBreak
{code} {example} {exceptions} {exception:ArgumentException} Attempting to set {{ViewState}} to {{PageLayout}} in an Excel 2003 or earlier workbook will throw an {{ArgumentException}}. {exception} {remarks} The viewing mode may be any of the values defined by [{{SheetViewState}}|Worksheet.SheetViewState]. By default, worksheets are in {{Normal}} mode. Note that only Excel 2007 or later workbooks support {{PageLayout}} mode. Setting this property to {{null}} will set the mode to {{Normal}}. {remarks}
Exceptions
Exception
ArgumentException
ArgumentException

Attempting to set ViewState to PageLayout in an Excel 2003 or earlier workbook will throw an ArgumentException.

Remarks

The viewing mode may be any of the values defined by SheetViewState. By default, worksheets are in Normal mode.

Note that only Excel 2007 or later workbooks support PageLayout mode.

Setting this property to null will set the mode to Normal.