Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import org.apache.poi.hssf.usermodel.HSSFWorkbook;
- import org.apache.poi.ss.usermodel.Cell;
- import org.apache.poi.ss.usermodel.Row;
- import org.apache.poi.ss.usermodel.Workbook;
- import org.apache.poi.xssf.usermodel.XSSFSheet;
- import org.apache.poi.ss.usermodel.Sheet;
- import org.apache.poi.xssf.usermodel.XSSFWorkbook;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- public class ExcelFactory {
- private static final String FILE_NAME = "rex.xlsx";
- public static void main(String[] args) throws IOException {
- FileOutputStream file = new FileOutputStream(FILE_NAME);
- Workbook wb = new HSSFWorkbook();
- Sheet sh = wb.createSheet("firstSheet");
- Row row = sh.createRow(0);
- Cell cell = row.createCell(0);
- cell.setCellValue("Honda");
- wb.write(file);
- if(wb!=null) {
- wb.close();
- }
- file.close();
- System.out.println("It is done!");
- }
- }
Add Comment
Please, Sign In to add comment