Learn C,C++,Java,JSP,Spring,Hibernate,Struts ,ASP,C#,PHP ,MYQSL ,HTML,CSS,JavaScript ,Jquery with in 500Rs/month.   
Congratulations:-Sumit,Rahul,Rajiv For TCS/Abhay,Priti,Pankaj for UST/Amardeep for Newgen For more Skype/mail:-r.raj4r@gmail.com   


POI api Projects

POI api Project 1

How to create a new workbook using POI?
Previous Home Next


In this page of the example we are going to create the workbook with help of the POI APIs in java language. for creation of the workbook we use the method createDocumentInputStream("Workbook").

This methods give the description copied from class.

package r4r;
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.eventusermodel.*;
import org.apache.poi.hssf.record.*;
import org.apache.poi.hssf.dev.EFHSSF;
public class findtypeofworkbook implements HSSFListener {
	public static void main(String[] args) throws IOException
	  FileInputStream fis = new FileInputStream(args[0]);
	  POIFSFileSystem pfs = new POIFSFileSystem(fis);
	  InputStream in = pfs.createDocumentInputStream("Workbook");
	  HSSFRequest hreq = new HSSFRequest();
	  hreq.addListenerForAllRecords(new findtypeofworkbook());
	  HSSFEventFactory fact = new HSSFEventFactory();
	  fact.processEvents(hreq, in);
	  public void processRecord(Record record)
	  switch (record.getSid())
	  case BOFRecord.sid:
	  BOFRecord bof = (BOFRecord) record;
	  if (bof.getType() == bof.TYPE_WORKBOOK)

Previous Home Next