Our excel generation is based on templates where we duplicate rows and columns as necessary to fit the data that is fed into them. In this particular usecase we add 23 rows and one column. Our counterparty uses jxl 2.5.5 to parse the incoming xls files generated by our poi setup. The added rows do not pose a problem but the added column does. The problem is that the values in the added column are not parsed and instead jxl outputs warnings: Warning: Cell D1 exceeds defined cell boundaries in Dimension record (3x42) Warning: Cell D2 exceeds defined cell boundaries in Dimension record (3x42) Warning: Cell D3 exceeds defined cell boundaries in Dimension record (3x42) Warning: Cell D4 exceeds defined cell boundaries in Dimension record (3x42) Warning: Cell D5 exceeds defined cell boundaries in Dimension record (3x42) You will note that more recent version of jxl do parse the excel correctly but only because they adjusted their error handling. The excels generated by apache poi still seem to have the wrong dimension. Updating the org.apache.poi.hssf.model.InternalSheet.addValueRecord() method from if (col.getColumn() > d.getLastCol()) to if (col.getColumn() >= d.getLastCol()) fixes the problem in our usecase.
Created attachment 28939 [details] Implements the suggested fix
Any chance you upload a junit test case for your patch? Regards, Yegor
Created attachment 28940 [details] Testcode that produces an excel that contains the wrong dimensions
Please note that if you open the generated xls file in excel, it automatically fixes the dimension issue (judging from the last modified even without explicitly hitting save)
Any progress on this issue? Will a fix be included in the library? Currently I'm running a locally patched version of poi and I'd rather not do that :)
Fixed in r1353962, junit added. Yegor
Hello everyone, i figure it out how to solve this problem. I simply update my jar file, here's the link were you can download those jar file: http://www.java2s.com/Code/Jar/p/Downloadpoi39jar.htm http://www.java2s.com/Code/Jar/p/Downloadpoiooxml39jar.htm http://www.java2s.com/Code/Jar/p/Downloadpoiooxmlschemas39jar.htm http://www.java2s.com/Code/Jar/j/Downloadjxl2612jar.htm I hope this will help.
Apache POI developer note: Please only download jars from sites you trust. You should always verify the checksums and signatures of the jars using the links on the official POI download page [1] to ensure the artifacts were not modified or corrupted. You can find the latest versions as well as a link to archived releases on the official site. [1] https://poi.apache.org/download.html#Available+Downloads
I wounder if we can remove those links since it might be bad to advertise jars that we did not produce.