I am using NPOI library to read in an existing workbook, and create a new one. When creating an HSSFSheet. I see that there is a method called SetZoom. What I don't see is a GetZoom method, or a Zoom property, in order to tell what that Zoom level is on the existing Worksheet. Any ideas?
2
There are 2 best solutions below
1
David P
On
Thanks to C. Helling, I was able to deduce that the Zoom was stored in the Window2. It, however, is stored as integer (eg - 65 for 65%, 150 for 150%). Setting the zoom of the new worksheet based off the zoom of the old sheet, is pretty easy:
destWS.SetZoom(sourceWS.Sheet.WindowTwo.NormalZoom, 100)
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in APACHE-POI
- Problem with sample code to set font properties for a whole XWPF Paragraph that includes Word fields
- Create filter on Integer column (with default values selected) while creating pivot table using apache poi
- Apache POI has some vulnerability with POI OOXML jar file
- The total number of document pages in the footer is not calculated correctly
- OutOfMemoryError: Java heap space. Read/Process Large Excel File(150MB) With Limited Memory (-Xmx130m) using Sax Parser
- Convert .docx to pdf using XDocReport
- Package[package ognl] of target class[class ognl.MethodFailedException] of target [ognl.MethodFailedException[java.lang.NoSuchFieldError:Factory]]
- word poi5.1.0 How to make chart add a series
- Is it possible to change Pivot Chart's (Pie chart) data color created using Pivot Table reference using Apache POI?
- Excel runs Apache-POI generated XLSX file but complains about working formula
- How to read Raw value rather then the formatted value from the excel sheet using POI library using XSSFReader class
- Apache POI Word insert both table and text at the same level
- Apache POI: get zoom level by using reflection
- APACHE POI: adding comment to existing word document
- Problem read formula excel file with apache poi
Related Questions in NPOI
- To set Different Colors For each line in Line Chart Using NPOI excel nuget package in .Net6 Core
- whether npoi nuget package accepts multiple colors in bar chart?
- To set Different Colors For each column in Column Chart Using NPOI excel nuget package in .Net6 Core
- To Set Position for Chart Title without overlaying Chart using NPOI nuget Excel Package
- NPOI Excel set predifined color theme
- NPOI Column Chart
- NPOI Excel a dropdownlist contains 2 fields
- I need to install NPOI package into a SSIS task script
- NPOI Mapper throws "Wrong Local header signature: 0x41D" exception
- Can NPOI set a password to protect the whole workbook?
- How to change the color of a cell to a user defined value while keeping its existing style using NPOI from F#?
- How to set the cell color to a user defined value using NPOI from F#?
- Not hidden apostrophe in Excel cell on NPOI generated xlsx
- ExcelDataReader is only read the 1st column from XSSFWorkbook-saved-file (C#)
- I cannot open the xlsm file after re-writing over it
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
This isn't going to be a satisfying answer, because I'm not sure there is one. I looked through the NPOI source code (SetZoom() in line 1161) as well as the original java source code from which is was ported (SetZoom() in line 1083). As you can see, the
SetZoom()method simply creates anSCLRecord:And digging further (in the original java):
Where we can see that it saves this information into a private field of
ISheet(InternalSheetin java):Thus, this information is not publicly accessible. If the Zoom is not set, it defaults to 100%, but I'm not aware of any way to access the Zoom of an existing sheet, as there doesn't seem to be any way to do this in NPOI short of modifying the internal source code yourself. Even so, this would only give you the zoom level that you set, as opposed to the existing one already on the worksheet.
It might be possible in EPPlus if you access the
worksheet.View.ZoomScale, but I am currently unable to test this at the moment.