0
I am trying to export a spreadsheet with Java, specifically a file .xlsx
, but I’m not getting it.
I’m doing it this way and it’s working, but it only works by putting the extension .xls
:
HSSFWorkbook workbook = new HSSFWorkbook();
String PathTillProject = System.getProperty("user.dir");
FileOutputStream fileOut = null;
fileOut = new FileOutputStream(PathTillProject + "/src/Export.xls");
workbook.write(fileOut);
If I put in the fileOut
the extent .xlsx
, at the time of opening the file, says that the file extension is not valid.
I’m importing the following file:
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
What should I do to be able to export with another extension?
but in this case, it is not to pick up a file
.xlsx
to read? tested here and did not work, I want to generate a file.xlsx
.– Gabriel Gonçalves