Quantcast
Channel: Java Programming Forum - Learn Java Programming - Apache POI
Viewing all articles
Browse latest Browse all 120

ERROE in apache Poi.jar pls help me

$
0
0
This is code
Code:

import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
public class PS
{
public static void main(Strings args[])
{
InputStream filename = new FileInputStream("D:/sathish/Example.xlsx");
XSSFWorkbook wb= new XSSFWorkbook(filename);
XSSFSheet sheet = wb.getSheetAt(0);
XSSFRow row1 = sheet.getRow(0);
XSSFCell a1= row1.getCell(0);
                String a1val= a1.getStringCellValue();
                XSSFCell a2= row1.getCell(1);
                String a2val=a2.getStringCellValue();
                XSSFCell a3= row1.getCell(2);
                String a3val=a3.getStringCellValue();
                System.out.println("A1: " + a1val);
                System.out.println("B1: " + a2val);
                System.out.println("C1: " + a3val);
        }
 }

This is my error:
Exception in thread "main" org.apache.poi.poifs .filesystem.officeXmlFileException:The supplied data appears to be Office 2007+Xml Your are calling the part of Poi that deals with ole2 office Documents. You need to call a different part of POI to process this data (Eg XSSF insted of HSSF)
at org.apache.poi.poifs.storage.headerBlock.<init><He aderBlock,java:131>

and Iam using 3.8 beta4 version of jar file

Viewing all articles
Browse latest Browse all 120

Latest Images

Trending Articles



Latest Images