I was trying to make an application that would hold data of what their customer is buying. Code for the method that is creating trouble for me is here:
private void MyData(long Invoice, String Name, int num, String[] products, int[] quantity, double tax, double cost) throws FileNotFoundException, IOException
{
FileInputStream inputStream = new FileInputStream(new File("SalesDetails.xlsx"));
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet worksheet = workbook.getSheetAt(0);
Invoice =Invoice+3;
for(int i=2; i<=27; i++)
{
XSSFCell cell=null;
cell = worksheet.getRow((int)Invoice).getCell(i);
switch (i) { //some cases. }
}
In this method, I am using Apache POI to write to an excel file.
The line where I put cell = worksheet.getRow((int)Invoice).getCell(i);
is creating an exception which I am not getting why. Please help me find solution to this.
I know there is already a similar question, but the solution to it is not helping me remove the exception.