Apache POI HSSF/XSSF support for newer Versions of Excel - apache-poi

Currently im working on a project which includes the Apache POI to read and write Excel files.
Im looking for a source that basically says that the POI (HSSF/XSSF) works for newer versions of Excel as well, since it says on the official website that HSSF supports Excel 97-2007. Yet i got Excel 2016 and when i'm trying to read data out of the file it's working just fine. Im Struggling to find something because i don't know where to look, and my first language isn't english so skimming through the changelogs is really hard for me.
Please let me know if this was a stupid question.
Thanks in advance.

Related

reading XLSB from apache poi

I've read it stated on multiple SO questions that Apache POI 3.16-beta3 has read-only support for xlsb files.
I am using poi 3.17 and cannot find any documentation or examples of this feature. The best I can find is an example of extracting raw text only via XSSFBEventBasedExcelExtractor, but this appears to be quite old (2010?) and I am unsure if this is the referenced capability.
Is there any documentation or examples of using poi to read xlsb files with the read-only parsing alluded to in the comments of this question: Exception reading XLSB File Apache POI java.io.CharConversionException and in an answer to this: Reading data from .xlsb in Clojure by Tim Allison ?
The functionality that Tim was referring to is actually XSSFBEventBasedExcelExtractor, and it was added in Apache POI 3.16. It can be used to extract text-content from the file.
There is currently no functionality to fully read the file content, though.
See also the JavaDoc for this class.

How to get DataValidation in Apache POI 3.9?

I am using Apache POI to write and read excel files,my poi version is 3.9,but now I faced a problem and do not find a good solution to solve it.
First I am use poi to write some datas to the excel table and will use DataValidation to add some prompt information in the table header,as the picture shown below:
The value in the cell is ABSInterention,and the prompt title is wrxuoh.After the excel generated successfully,other users will add some modification to the data cell and I need to read and parse the excel file and I want to get the prompt value wrxuoh again.So my question is:
When I read excel file using POI3.9,how can I get all the DataValidations for the current sheet?
I am using HSSFWorkbook and HSSFSheet.I found there is a method called getDataValidations in the POI Sheet,but I can not find this method in my poi3.9 jar file and also can not find it in the POI3.9 javadoc.
any help would be grateful!
Promoting a comment to an answer - you can't
That functionality was added to Apache POI after the 3.9 release you mention in your question
As per the Apache POI Changelog, you need to upgrade to at least POI 3.11 beta 3 to use that feature. 3.11 final, when it comes out shortly, will be the first stable release to include it

Does Apache POI support the "strict" variant of ISO/IEC 29500?

With M$ Excel 2013 there are 2 variants of XLSX, the "Transitional" which M$ supported with XLSX in Excel 2010, and "Strict" = OOXML. Is POI able to read and write the latter? If so, from which version of POI?
Yes, and POI 3.5 (though you'd be strongly advised to use 3.9, or wait about a week for a 3.10 beta)
POI uses the official ISO XML schema files to process the XML files, so by default works with the strict (official) form. There's not that much different between the two, but where there is such a difference that matters, POI will have code to munge the low level XML skipping what the schema would normally say.
No, Apache POI does not support Open XML Strict as of this date.
See source: https://helpwanted.apache.org/task.html?5a5d86c834df99c79279b34d6ecdc413107874be

Excel comments using xssf eventusermodel using apache poi 3.7

Here is a link to a code that uses apache 3.7.
http://massapi.com/source/poi-3.7/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFEventBasedExcelExtractor.java.html
How can i edit this code to get the comments in excel file?
Comments are stored in a different stream (Document Part) to the sheet, so you'd need to navigate from the sheet to the comments (if present) and parse that
The relation will be of type XSSFRelation.SHEET_COMMENTS
As the comments part is normally fairly small, you should be fine to just access it using normal UserModel code. CommentsTable is the class that will give you easy access to it, pass that comments part and the relation from the sheet and work your way through the comments in turn
If you get it working, send a patch to POI so it gets included in future!

Exporting Native Excel 2007 Files From .NET

Does anyone know of resources that can help me export simple contents of a GridView to a native Excel 2007 format (i.e. the OpenOfficeXML format).
I've already seen solutions like Matt Berseth's, and in fact I have been using that for a while, but it comes with an annoying warning produced by Excel 2007 as documented here stemming from the fact that a native Excel file is not generated; rather it is HTML.
My initial research shows that, at the core, xlsx files are zip files, but I have no idea how to produce these or what goes in them.
Any suggestions (or tutorials) would be greatly appreciated.
CarlosAg has an ExcelXML writer which works really well. It isn't a native excel 2007 formatted file, but it will be readable in excel 2007.
You will need to write a little method to do the exporting manually, the API is very straight forward though. You will create a sheet object, then a row object, then a cell object. You can just loop through your data and output it. The examples on the site are pretty decent.
I prefer using Microsoft's own Open XML Format SDK. It is free, it is released by Microsoft and it creates real .xlsx files.
You can find the reference documentation here, as you can see, it is pretty straightforward to use.
SpreadsheetGear for .NET can read and write native xls and xlsx files and is easier to use (takes less of your time) than other solutions because it has an Excel like API so you don't have to learn anything about Open XML.
You can see some live ASP.NET (C# and VB) Excel Reporting examples here and download an evaluation version here.
Disclaimer: I own SpreadsheetGear LLC

Resources