Reputation: 3279
I am trying to learn apache poi but the method workbook.createSheet() seems to be not recognized by the IDE. reviewing the suggestions that are there, many methods are available for the workbook object but not the createSheet method.
Workbook wb = Workbook.createWorkbook((List<Record>) response.getOutputStream());
Sheet s = wb.createSheet(); <<-- not working for me.
my import statements look like this and I have no idea what is the problem. maybe i need some snooze.
import org.apache.*;
import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.model.Workbook;
import org.apache.poi.hssf.record.Record;
edit:
the library that I am using, I just downloaded it and I added it as an external library in eclipse
Upvotes: 0
Views: 2930
Reputation: 48336
You're importing the wrong classes!
org.apache.poi.hssf.model.*
should only be used for low level handling. The classes you want are under org.apache.poi.ss.usermodel
. In there you'll find the correct createSheet method
If you follow the Apache POI examples you'll end up with something like:
import org.apache.poi.ss.usermodel.*;
Workbook wb = WorkbookFactory.open(new File("myfile.xls")); // or .xlsx
Sheet s = wb.createSheet();
// Add some more data, then save
Upvotes: 3
Reputation: 3279
Considering the amount of time that which I don't have lots, and the comparison between the functionalities between the two APIs, I'll just use JXL for now.
Upvotes: 0