First off I feel that I should state that I am very much a Java novice. For my research I am modifying a very extensive code in order to optimize aspects of the data analysis process. In order to do this I need to export the data generated in the java code to an excel document where I can then arrange and display the data along with a few other calculations. I've referenced the internet and decided to use Apache POI 3.7 to export the data. As of now I just have written some very simple code in an example project just to get a feel for the POI. However I'm getting syntax errors with the last two lines of my code which I assume is relatively easy to fix.
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.FileOutputStream;
import java.io.File;
import java.io.IOException;
public class Example {
Workbook wb = new HSSFWorkbook();
//Workbook wb = new XSSFWorkbook();
Sheet sheet1 = wb.createSheet("new sheet");
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
}
Also, in the future when I am looking to export my data I assume my data will be stored as some string but I wasn't sure if the data has to be stored or labeled in the java program in order to effectively be exported to Excel.