How can I set sheet zoom% to 120 using Apache POI ?
I tried with sheet.setZoom(5,4)
but its outputs to 125% zoom.
Also this method accepts only integers.
Any help would be appreciated.
The API docs for the Sheet interface in Apache POI state:
setZoom(int scale) - Window zoom magnification for current view representing percent values.
and
setZoom(int numerator, int denominator) Deprecated. 2015-11-23 (circa POI 3.14beta1). Use setZoom(int) instead.
So try:
sheet.setZoom(120);
Or to use the deprecated method on an older version of the API:
sheet.setZoom(12, 10);
Note, 5/4=1.25 which is the reason you get zoomed to 125%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With