Excel file Create & Data write

package webapp;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class XLSX_create {

public static void main(String[] args) throws IOException {

Workbook fout_workbook;
Sheet fout_worksheet;
Cell fout_cell;;

fout_workbook = new XSSFWorkbook();
fout_worksheet = fout_workbook.createSheet(“csr”);

fout_cell = fout_worksheet.createRow(1).createCell(1);
fout_cell.setCellValue(“Love u mom”);

fout_cell = fout_worksheet.getRow(1).createCell(3);
fout_cell.setCellValue(“Love u Bro”);

fout_cell = fout_worksheet.getRow(1).createCell(5);
fout_cell.setCellValue(“Love u Sis”);

CellStyle fout_style;
fout_style = fout_workbook.createCellStyle();

Font fis_font;
fis_font = fout_workbook.createFont();



FileOutputStream out = new FileOutputStream(new File(“C:\\Users\\Suresh\\Desktop\\xlcreate.xlsx”));



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s