R4R
Right Place For Right Person TM
 
R4R Right ArrowJavaRight Arrow Java APIsRight ArrowPOI APIRight ArrowPOI APIs Basic Example
Previous Home Next

How to create a sheet using POI?


Introduction:

In this page of the example we are going to show you how we can create the excel sheet by help of the POI API in java language. for creation of this sheet we are using some method of the POI. firstly we create the object of HSSFWorkbook. then create the fileoutputstream for passing the file name and at last Write the FileOutputStream to workbook object.



Descriptions:
 

 
Firstly we create the object of HSSFWorkbook. then create the fileoutputstream for passing the file name and at last Write the FileOutputStream to workbook object.


SourceCode:

 
package r4r;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
//import org.apache.poi.ss.usermodel.Workbook;
public class POINewWorkbookCreate {
	public static void main(String[] args) throws IOException {
		// Create a workbook object.
		HSSFWorkbook book = new HSSFWorkbook();
		// Create a FileOutputStream by passing the excel file name.
		FileOutputStream outStream = new FileOutputStream("POINewWorkbookCreate.xls");
		// Write the FileOutputStream to book object.
		workbook.write(outStream);
		// Close the FileOutputStream.
		outputStream.close();
		System.out.println("Sheet is created");
	}
}




Output of SourceCode:
 Sheet is created

How to create a sheet using POI?

Previous Home Next
R4R Right ArrowJavaRight Arrow Java APIsRight ArrowPOI APIRight ArrowPOI APIs Basic Example

Tutorials,Examples,Questions and Answer

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R