Nov 22

The Apache POI project helps you read and write Microsoft OLE2 and Office Open XML (OOXML) documents.

OLE2 includes Excel (XLS), Word (DOC) and Powerpoint (PPT) files.

Office Open XML Format is the new standards based XML file format found in Microsoft Office 2007 and 2008. This includes XLSX, DOCX and PPTX files.

Use POIFS to read OLE2 files

HSSF is used to read and write Excel (XLS) files.

XSSF is used to access OOXML Excel files (XLSX).

The combined SS interface (SS = HSSF + XSSF) is designed to allow you to access all Excel files (XLS and XLSX).

We shall be posting some POI examples in the next few weeks, let us know if there is anything specific you need.

written by objects \\ tags: , , , , , , , , , , ,

Nov 24

Often you need to read a file line by line. Alternatively sometimes you want to read text word by word (for example to count the occurrence of different words). The Scanner classes next() method can be used for this as shown in the following example.

		Scanner input = new Scanner(file);  
		while(input.hasNext()) {
			String word = input.next();
		}

written by objects \\ tags: , , , ,