A little JAVA break…

Writing xlsx with java…

Today i want to tell you, how do you create and write excel files in java. First of all we must download apache’s POI api in here. (The JAVA api for Microsoft Document.) In fact this api doesn’t for only excel. You can use this api for word, power point, and etc… It supports office from 97 to 2007. You can create,read or write xls, xlsx, doc, docx and etc.. I must say this api is more fastest than c# office interop api. You must add jars into your project.

Now we create an excel xlsx file and we write some text in this file. Ok lets write some code.

You must create workbook, sheet, row and cell for write something into the cell. I use XSSF for xlsx, if you want to create, read or write xls you can use HSSF. For about more information please visit POI project website. You can find more good artice at there.

Not important. In the same time, they say “Office OpenXML Format is the new standards based XML file format found in Microsoft Office 2007 and 2008. This includes XLSX, DOCX and PPTX. The project provides a low level API to support the Open Packaging Conventions using openxml4j.”.

When i try to load a file which is like 1 mb , the program crashes saying insufficient heap size, at this line.
Workbook wb = new XSSFWorkbook();
Is there any other api which would help me work with large xlsx files?

thanks for the tip, could you help with some example for BIG FILES ?
I have to write a very big excel 2007 file (in fact this is why I should use xlsx instead xls the number of rows is about 200,000)
but when I tried this solution it was very slow and I got out of memory error