Spread WPF 18
Features / Zoom
In This Topic
    Zoom
    In This Topic

    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.

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

    Elements that support Zoom:

    Elements that do not support Zoom:

    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.

    Copy Code
    <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>
    
    Copy Code
    // Set ZoomScale to 400.
    spreadSheet1.Workbook.Worksheets[0].View.ZoomScale = 400;
    // Set AllowUserZoom to true.
    spreadSheet1.AllowUserZoom = true;
    
    Copy Code
    ' Set ZoomScale to 400.
    spreadSheet1.Workbook.Worksheets(0).View.ZoomScale = 400
    ' Set AllowUserZoom to true.
    spreadSheet1.AllowUserZoom = True