Back to Devexpress

DocumentOptions.ZoomMode Property

officefileapi-devexpress-dot-spreadsheet-dot-documentoptions-5607e85e.md

latest4.7 KB
Original Source

DocumentOptions.ZoomMode Property

Gets or sets a zoom mode for all worksheets in the document.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public WorksheetZoomMode ZoomMode { get; set; }
vb
Public Property ZoomMode As WorksheetZoomMode

Property Value

TypeDescription
WorksheetZoomMode

One of the WorksheetZoomMode enumeration values specifying the zoom mode.

The default is WorksheetZoomMode.AllViews.

|

Available values:

NameDescription
AllViews

Specifies that the zoom level defined by the SheetView.Zoom property is applied to all worksheet views.

| | ActiveView |

Specifies that the zoom level defined by the SheetView.Zoom property is applied only to the worksheet’s active view.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ZoomMode
ISpreadsheetComponent

.Options .ZoomMode

|

Remarks

The ZoomMode property allows you to specify how to apply the zoom setting defined by the SheetView.Zoom property to a worksheet. You can specify the zoom percentage for all worksheet views (Normal, Page Layout, and Page Break Preview) at once or for the current view only (Worksheet.ActiveView). The ZoomMode property is set to WorksheetZoomMode.AllViews by default.

To specify an individual zoom percentage for each worksheet view, set the ZoomMode property to WorksheetZoomMode.ActiveView, and then define the necessary zoom settings. Use the WorksheetView.ViewType property to switch between the worksheet views.

csharp
Worksheet worksheet = workbook.Worksheets.ActiveWorksheet;
// Set the document's zoom mode to ActiveView
// to specify an individual zoom percentage for each worksheet view.
workbook.Options.ZoomMode = WorksheetZoomMode.ActiveView;
// Specify the zoom level for the Page Break Preview.
worksheet.ActiveView.ViewType = WorksheetViewType.PageBreakPreview;
worksheet.ActiveView.Zoom = 90;
// Specify the zoom level for the Page Layout view.
worksheet.ActiveView.ViewType = WorksheetViewType.PageLayout;
worksheet.ActiveView.Zoom = 110;
// Specify the zoom level for the Normal view.
worksheet.ActiveView.ViewType = WorksheetViewType.Normal;
worksheet.ActiveView.Zoom = 120;
vb
Dim worksheet As Worksheet = workbook.Worksheets.ActiveWorksheet
' Set the document's zoom mode to ActiveView
' to specify an individual zoom percentage for each worksheet view.
workbook.Options.ZoomMode = WorksheetZoomMode.ActiveView
' Specify the zoom level for the Page Break Preview.
worksheet.ActiveView.ViewType = WorksheetViewType.PageBreakPreview
worksheet.ActiveView.Zoom = 90
' Specify the zoom level for the Page Layout view.
worksheet.ActiveView.ViewType = WorksheetViewType.PageLayout
worksheet.ActiveView.Zoom = 110
' Specify the zoom level for the Normal view.
worksheet.ActiveView.ViewType = WorksheetViewType.Normal
worksheet.ActiveView.Zoom = 120

Note

The current versions of the WinForms, WPF and ASP.NET spreadsheet controls display the Normal worksheet view only.

See Also

Zoom

DocumentOptions Class

DocumentOptions Members

DevExpress.Spreadsheet Namespace