[]
        
(Showing Draft Content)

Zoom

The zoom feature in the worksheet improves usability and control, especially when working with large data. You can specify the zoom scale for a worksheet and allow users to adjust the zoom level as needed.

Zoom lets you change the magnification of your worksheet to fit more data on a single screen or focus on specific details. The ZoomScale property of the IWorkSheetView interface allows you to set the magnification level of the worksheet view. A higher value indicates a more zoomed-in view. Default zoom levels range from 10% (zoom out) to 400% (zoom in). For each change, the scale value is zoomed in or out by the closest value to (100 +/- 15*n). For example, if the ZoomScale property value is 123, then the zoom value will be scaled to 130 and the zoom-out value to 115.

Additionally, you can use the AllowUserZoom property, which enables users to adjust the zoom level of the worksheet manually. Setting this property to true allows users to zoom in and out of the worksheet at runtime by holding down the Ctrl key and using the mouse wheel.

!type=note

Note: The zoom value is retained when you import or export your worksheet to Excel.

Elements that support Zoom:

  • Cell content

  • Header

  • Conditional formatting icons and data bars

  • Group bars, lines, and group expand/collapse icons

  • Circles highlighting invalid data with data validation

  • Cell types, such as dropdown button, spin button, dropdown calendar/calculator

  • Dropdown function list for table’s total cell

Elements that do not support Zoom:

  • Filter icon and context menu

  • Grid lines

  • Data validation dropdown buttons and messages

Refer to the following example code to enable zooming in your worksheet and set a specific zoom scale level to 400. Zoom levels can be set in both the XAML view and the code view.

XAML

<Grid>
     <gss:GcSpreadSheet Margin="5" Grid.Row="1" x:Name="spreadSheet1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" AllowUserZoom="True">
         <gss:GcSpreadSheet.Sheets>
             <gss:SheetInfo ColumnCount="20" RowCount="50">
                 <gss:SheetInfo.View>
                     <gss:SheetView ZoomScale="400"/>
                 </gss:SheetInfo.View>
             </gss:SheetInfo>
         </gss:GcSpreadSheet.Sheets>
     </gss:GcSpreadSheet>
</Grid>

C#

// Set ZoomScale to 400.
spreadSheet1.Workbook.Worksheets[0].View.ZoomScale = 400;
// Set AllowUserZoom to true.
spreadSheet1.AllowUserZoom = true;

VB

' Set ZoomScale to 400.
spreadSheet1.Workbook.Worksheets(0).View.ZoomScale = 400
' Set AllowUserZoom to true.
spreadSheet1.AllowUserZoom = True