I am working with apache poi and I create a HSSF workbook and try to open a xlsx file. But when I open with excel, it says the file is corrupted. Here is my code.
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.FileOutputStream;
public class Excel {
public static void main(String[] args) {
Workbook workbook = new HSSFWorkbook();
try {
FileOutputStream output = new FileOutputStream("Test1.xls");
workbook.write(output);
output.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}