Zoom Factor using Apache POI and Aspose.Cells

Aspose.Cells - Zoom Factor

Microsoft Excel provides a feature that lets users set a worksheet’s zoom or scaling factor. This feature helps users to see the worksheet contents in smaller or larger views.

Aspose.Cells provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a WorksheetCollection that allows access to each worksheet in an Excel file.

A worksheet is represented by the Worksheet class. The Worksheet class provides a wide range of properties and methods for managing worksheets. To set a worksheet’s zoom factor, use the Worksheet class’s setZoom method.

Java

Worksheet worksheet = worksheets.get(0);

// Setting the zoom factor of the worksheet to 75
worksheet.setZoom(75);

Apache POI SS - HSSF XSSF - Zoom Factor

Apache POI provides the Sheet.setZoom() method, which makes the zoom feature available.

Java

Sheet sheet1 = wb.createSheet("new sheet");
sheet1.setZoom(3, 4);   // 75 percent magnification

Download Running Code

Download Sample Code