- Code: Select all
function excelRead( ) {
// importPackage( org.apache.poi.hssf.usermodel );
importClass( Packages.org.apache.poi.hssf.usermodel.HSSFSheet );
importClass( Packages.org.apache.poi.hssf.usermodel.HSSFWorkbook );
importClass( Packages.java.io.File );
importClass( Packages.java.io.FileInputStream );
/** @type {java.io.FileInputStream} */
var file = new FileInputStream( new File( "C:\\test.xls" ) );
/** @type {org.apache.poi.hssf.usermodel.HSSFWorkbook} */
var workbook = new org.apache.poi.hssf.usermodel.HSSFWorkbook( file );
}
If I execute the above function, I get the following error.
org.mozilla.javascript.EvaluatorException: Function importClass must be called with a class; had "[JavaPackage org.apache.poi.hssf.usermodel.HSSFSheet]" instead.
HSSFSheet is a class and exists in the library. Does anyone know whats the problem here?