Zoom in/out by programming

Worksheet provides the following methods that are used to zoom in/out the worksheet.

sheet.ZoomIn(); // +0.1f scale factor
sheet.ZoomOut(); // -0.1f scale factor
sheet.ZoomReset(); // reset to 1f scale factor


Set scale factor

Instead using the methods above, it is possible to change the worksheet scale directly:

sheet.SetScale(2f, Point.Empty);

second argument is reserved, should be Point.Empty currently.

Zoom in/out by mouse

By holding the Ctrl key and slide mouse wheel to zoom spreadsheet in or out. This is a native built-in behavior.

Disable zoom by mouse

By change worksheet settings Behavior_MouseWheelToZoom to false can disable the zoom-by-mouse feature.

worksheet.SetSettings(WorksheetSettings.Behavior_MouseWheelToZoom, false);

Learn more about built-in behaviors.

Next: Paging & Print