package com.mysite.inmarsat;
import java.io.*;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
/**
* Created by gmlynarczy001 on 2016-09-14.
*/
public class Xwriter {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet uat = workbook.createSheet("UAT");
HSSFSheet dht = workbook.createSheet("DHT");
int n = 0;
public void saveExcelMC
(String mc
){
try {
if (EnvAndDP.DP.equals("SHARE")) {
n = 1;
} else if (EnvAndDP.DP.equals("1090")) {
n = 2;
} else if (EnvAndDP.DP.equals("1180")) {
n = 3;
}
if (EnvAndDP.ENV.equals("UAT")) {
HSSFRow head = uat.createRow((short) 0);
head.createCell(0).setCellValue("TYPE");
head.createCell(1).setCellValue("SHARE");
head.createCell(2).setCellValue("1090X");
head.createCell(3).setCellValue("1180X");
HSSFRow rowMC = uat.createRow((short) 1);
rowMC.createCell(0).setCellValue("Major Corporate");
rowMC.createCell(n).setCellValue(mc);
} else if (EnvAndDP.ENV.equals("DHT")) {
HSSFRow head = dht.createRow((short) 0);
head.createCell(0).setCellValue("TYPE");
head.createCell(1).setCellValue("SHARE");
head.createCell(2).setCellValue("1090X");
head.createCell(3).setCellValue("1180X");
HSSFRow rowMC = dht.createRow((short) 1);
rowMC.createCell(0).setCellValue("Major Corporate");
rowMC.createCell(n).setCellValue(mc);
}
workbook.write(fileOut);
fileOut.close();
e.printStackTrace();
}
}
public void saveExcelVess
(String vess
){
try {
if (EnvAndDP.DP.equals("SHARE")) {
n = 1;
} else if (EnvAndDP.DP.equals("1090")) {
n = 2;
} else if (EnvAndDP.DP.equals("1180")) {
n = 3;
}
if (EnvAndDP.ENV.equals("UAT")) {
HSSFRow head = uat.createRow((short) 0);
head.createCell(0).setCellValue("TYPE");
head.createCell(1).setCellValue("SHARE");
head.createCell(2).setCellValue("1090X");
head.createCell(3).setCellValue("1180X");
HSSFRow rowVess = uat.createRow((short) 2);
rowVess.createCell(0).setCellValue("Vessel");
rowVess.createCell(n).setCellValue(vess);
} else if (EnvAndDP.ENV.equals("DHT")) {
HSSFRow head = dht.createRow((short) 0);
head.createCell(0).setCellValue("TYPE");
head.createCell(1).setCellValue("SHARE");
head.createCell(2).setCellValue("1090X");
head.createCell(3).setCellValue("1180X");
HSSFRow rowVess = dht.createRow((short) 2);
rowVess.createCell(0).setCellValue("Vessel");
rowVess.createCell(n).setCellValue(vess);
}
workbook.write(fileOut);
fileOut.close();
e.printStackTrace();
}
}
}