Currently I'm trying to implement the code given in the answer to this question:
CTSheetView view = sheet.getCTWorksheet().getSheetViews().getSheetViewArray(0);
view.setView(STSheetViewType.PAGE_LAYOUT);
but the poi-ooxml-schemas (version 3.14) JAR file does not contain the class STSheetViewType. I delved into the poi-ooxml-schemas JAR file (using 7ZIP) and found that the class file STSheetViewType$Enum.class existed within the path:
org.openxmlformats.schemas.spreadsheetml.x2006.main.STSheetViewType$Enum.class
But (If I'm not mistaken) The '$' signifies an inner/nested class, meaning the STSheetViewType Enum is encapsulated within another class. I checked the documentation on the STSheetViewType class in an older version of poi-ooxml-schemas (version 1.1) here and found that the class STSheetViewType contained an inner Enum STSheetViewType.Enum.
This also seems to be confirmed by the errors I'm receiving from within Eclipse. I get these errors when using the code shown above:
"STSheetViewType cannot be resolved to a variable"
"The type org.openxmlformats.schemas.spreadsheetml.x2006.main.STSheetViewType cannot be resolved. It is indirectly referenced from required .class files"
Which further makes me believe that the STSheetViewType.Enum is missing its parent STSheetViewType class file. But why? I checked the documentation on the new version of poi-ooxml-schemas-3.14 and found no mention of STSheetViewType in the changelogs. I've downloaded the binary zip file for POI several times to ensure that my download wasn't faulty, I even downloaded the source and tried building the JARs but the class file is missing each time.
I found that a class STSheetViewType with seemingly the same functionality is held in another Jar file here but I can't seem to import the class correctly. Is such a thing even possible? Or must the class file come with the poi-ooxml-schemas-3.14 JAR file?
Ultimately I'd like to find out how to make the above code compatible with the current version of poi-ooxml-schemas-3.14 JAR. Any information or insight shed on that would be greatly appreciated.
STSheetViewType
the fullyooxml-schemas-1.3.jar
is needed as mentioned in poi.apache.org/faq.html#faq-N10025. So downloadooxml-schemas-1.3.jar
and put it in the class path. But you could trySTSheetViewType.Enum.forString("pageLayout");
without this additional jar since the classEnum
is static - not tested. – Axel Richter