RowIterator in POI
Hello Techies,
Iam using jakarta's poi for reading excel sheet. Iam getting problem in using rowIterator().
int tempEno = 0;
String tempEname = null;
while (it.hasNext())
row = (HSSFRow) it.next();
HSSFCell cell = row .getCell(myTradingConstants.ENO_COLUMN_NUMBER);
tempEno =(int)cell.getNumericCellValue();
System.out.println("tempEno"+tempEno);
cell = row.getCell(myTradingConstants.ENAME_COLUMN_NUMBER);
tempEname = cell.getStringCellValue();
System.out.println("tempEname"+tempEname);
}Iam getting the following exception
Exception in thread "main" java.lang.NumberFormatException: You cannot get a numeric value from a String based cell
at org.apache.poi.hssf.usermodel.HSSFCell.getNumericCellValue(HSSFCell.java:712)
at myTradeSample.main(myTradeSample.java:67)
cell type is either Numeric,string,error and fourmula and blank. But iam having other types also Date,Double,Time etc. In this case How to resolve the problem.
Where as if i did not used rowIterator() n by using getLastRowNum()
it is working fine.
int lastRowNumber = sheet.getLastRowNum();
for (int i = 1; i <= lastRowNumber; i++) {
HSSFCell cell = row .getCell(myTradingConstants.ENO_COLUMN_NUMBER);
tempEno = (int) cell.getNumericCellValue();
cell = row.getCell(myTradingConstants.ENAME_COLUMN_NUMBER);
tempEname = cell.getStringCellValue();But problem with getLastRowNum() is that iam not getting xact number of rows in the sheet.
Iam having 24 rows But it is showing 35.
Why iam facing problem with getLastRowNUmber().
thanx(inadvance),
ramu
But problem with getLastRowNum() is that iam not
not getting xact number of rows in the sheet.
Iam having 24 rows But it is showing 35.
Why iam facing problem with getLastRowNUmber().I don't know what this "rowiterator" is, I can't easily find it in the POI documentation. You didn't say what class it is so you can look it up yourself. However in regard to your last question: there's a method in HSSFSheet whose description says
"Returns the number of phsyically defined rows (NOT the number of rows in the sheet)"
This suggests that you don't understand the various kinds of rows, physically-defined or not.
Similar Messages
-
POI getCellStyle and empty string problem
I'm having a problem getting the style of a cell from and excel input file and setting to an output file.
I also have a problem recognizing blank cells that are not null in the input file here is my code any help would be great.
package Trace;
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import java.util.StringTokenizer;
import org.apache.poi.poifs.filesystem.*;
import java.lang.Runtime;
public class Converter1 {
private static short bhyvb= 0;
private static short foreground, background;
private static String[][] cellGridOut;
private static int numRows, numColumns, clock;
private static POIFSFileSystem fs;
private static HSSFWorkbook wbin, wbout;
private static HSSFSheet sheetIn, sheetOut;
private static HSSFRow rowIn, rowOut;
private static HSSFCell cellIn, cellIn1, cellOut;
private static FileOutputStream fileOut = null;
private static String rowIterator, rowIterator1;
private static HSSFCellStyle style, style1;
public static void main(String[] args) {
//Take in 2 inputs mandatory, Input Event Trace excel file and Time Interval respectively
if (args.length != 1)System.err.println("Input Excel File");
//Create a new POI file system and HSSF workbook with your excel input file
InputStream input = Converter.class.getResourceAsStream(args[0]);
try{
fs = new POIFSFileSystem(input);
wbin = new HSSFWorkbook(fs);
}catch (Exception e){System.err.println("File input error");}
wbout = new HSSFWorkbook();
sheetIn = wbin.getSheetAt(0);
numRows = sheetIn.getLastRowNum();//numRows=723
style = wbout.createCellStyle();
//style.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
//style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//get number of columns
rowIn = sheetIn.getRow(0);
boolean done = false;
int testNullPointer;
numColumns=0;
while(!done){
//System.out.println(ColumnInc);
cellIn = rowIn.getCell((short)numColumns);
numColumns+=1;
try{
testNullPointer = cellIn.getCellType();
}catch(NullPointerException npe){
done = true;
numColumns-=1; //number of columns = 25
converterIt();
//Create new output file, if it exists delete it
File myFile = new File("converted.xls");
if(myFile.exists()){
myFile.delete();
//Create new file output stream
try {
fileOut = new FileOutputStream(myFile);
} catch (IOException ioe) {}
//write all conversion data to output file
try{
wbout.write(fileOut);
fileOut.close();
}catch (IOException ioe) {}
public static void converterIt(){
boolean nextDone = false;
boolean nextDone1 = false;
for(int i=0; i<numColumns; i++){
clock =1;
rowIn = sheetIn.getRow(0);
cellIn = rowIn.getCell((short)i);
String getTopRow = cellIn.getStringCellValue();
sheetOut = wbout.createSheet(getTopRow+"_s"+i);
sheetOut.setColumnWidth((short)0, (short)(13 * 256));
sheetOut.setDefaultColumnWidth((short)25);
for(int j=0; j<=numRows; j++){
if(j==0){
rowIn = sheetIn.getRow(j);
cellIn = rowIn.getCell((short)i);
String temp2 = cellIn.getStringCellValue();
rowOut = sheetOut.createRow((short)j);
cellOut = rowOut.createCell((short)j);
cellOut.setCellValue(temp2);
cellOut = rowOut.createCell((short)(j+1));
cellOut.setCellValue("CLOCK");
if(j==1){
rowIn = sheetIn.getRow(j);
cellIn = rowIn.getCell((short)i);
double temp3 = cellIn.getNumericCellValue();
rowOut = sheetOut.createRow((short)j);
cellOut = rowOut.createCell((short)0);
cellOut.setCellValue(temp3);
cellOut = rowOut.createCell((short)1);
cellOut.setCellValue("");
nextDone=false;
nextDone1=false;
if(j>1){
rowIn = sheetIn.getRow(j);
try{
cellIn = rowIn.getCell((short)i);
}catch(NullPointerException npe){
rowIterator = "";
nextDone=true;
if(!nextDone){
try{
rowIterator = cellIn.getStringCellValue();
style = cellIn.getCellStyle();
}catch(NullPointerException npe){}
if(j==2){
rowOut = sheetOut.createRow((short)(clock+1));
cellOut = rowOut.createCell((short)0);
cellOut.setCellValue(rowIterator);
cellOut = rowOut.createCell((short)1);
cellOut.setCellValue(j-1);
clock+=1;
}else{
rowIn = sheetIn.getRow(j-1);
try{
cellIn = rowIn.getCell((short)i);
}catch(NullPointerException npe){
rowIterator1 = "";
nextDone1=true;
if(!nextDone){
try{
rowIterator1 = cellIn.getStringCellValue();
}catch(NullPointerException npe){}
if(rowIterator1!=rowIterator && j>2){
rowOut = sheetOut.createRow((short)clock+1);
cellOut = rowOut.createCell((short)0);
cellOut.setCellValue(rowIterator);
//System.out.println(style);
cellOut.setCellStyle(style);
cellOut = rowOut.createCell((short)1);
cellOut.setCellValue(j-1);
clock+=1;
}//if
}//for
}//for
}//converterIt
}//Converter1 CLASSENDI am not sure about the cell style as it looks like you are doing it right. For the null or blank cells it looks like you are only checking for null not "".
-
Hello,
I want to read in excel files to a JTable. I was able to read in .xls files, but have problems reading .xlsx files. Maybe there is something i need to add to the following code:
FileInputStream iStream = new FileInputStream(newFile);
POIFSFileSystem fs = new POIFSFileSystem(iStream);
Workbook wb1 = WorkbookFactory.create(fs);
Sheet sheet = wb1.getSheetAt(0); // get the first sheet data
// Iterate over each row in the sheet
Iterator rows = sheet.rowIterator();
while(rows.hasNext()) {
Row row = (Row) rows.next();
.............The compiler is complaining about the 3rd line: Workbook wb1 = WorkbookFactory.create(fs);
Thanks.@ejp:
I quite agree with you. It's a runtime exception -
org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. You 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 instead of HSSF)I've tried searching before coming here to ask. HSSF processes .xls files only, XSSF processes .xlsx files only while SS is supposed to read both .xls and .xlsx files. Maybe there's anyone that has used it before who can help out.
Thanks -
Hi ,
Following is the normal code that i am using to read excel file:
HSSFSheet sheet = workbook.getSheetAt(0);
for (Iterator rit = sheet.rowIterator(); rit.hasNext(); ) {
HSSFRow row = (HSSFRow)rit.next();
int rowIndex= row.getRowNum();
for (Iterator cit = row.cellIterator(); cit.hasNext(); ) {
HSSFCell cell = (HSSFCell)cit.next();
short cellIndex= cell.getCellNum();
For the very first row it correctly gives me rowIndex=0 , but when inside 0th row it should give me cellIndex=0 for the first time , but its giving mr cellIndex=1.
That way it is skipping 0th column. Its not picking 0th column in 0th row...its directly picking 1st column in 0th row.
Can anybody please tell me why this is happening???
thanx in advanceIt appears the cell order you see in the excel document is not the order the POI reads them.
Here is a link I found describing it and the work around:
http://forum.java.sun.com/thread.jspa?threadID=656009&messageID=4405384
For your own future reference: I found this link by searching google for unique words 'HSSFSheet' and 'celliterator' -
i have a problem with jakarta POI.
for (Iterator rows = sheet.rowIterator(); rows.hasNext();) {
row = (HSSFRow) rows.next();
// I want to check whether this row does contain any data or not ?
i tried row!=null to check no data in this row ....but this does not work.
can you suggest any alternative ?check the number of cells in the row, and the content of each cell.
I've noticed that it sometimes returns empty rows and/or empty cells in rows when you'd expect to get nothing.
Whether due to the way Excel writes things or what I've never bothered to investigate in detail. -
Exception when using Apache POI in ADF
Goodmorning;
i'm using jdev 11g, i m trying to use Apache POI to import the content of Microsoft XL file into my database.
i already do that succesfully on netbeans. but not on jdev.
first i download the POI package from the apache web site, and i create a librarie and add the jar files to the jdev by using Tools --> Manage Libraries, this is the list of the jar file : poi-3.6-20091214.jar, poi-contrib-3.6-20091214.jar, poi-ooxml-3.6-3-20091214.jar and poi-scratchpad-3.6-20091214.jar.
next, create a jsf page with a boutton, then i enable the binding of this page by using Design --> Page Properties --> component binding --> check Auto Bind
in the action method of the buton i put the following code :
public String cb1_action() throws FileNotFoundException, IOException {
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String userPassword = "";
try {
InputStream fs = new FileInputStream("/home/Rachid/test1.xls");
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = null;
for (Iterator rowIt = sheet.rowIterator(); rowIt.hasNext();) {
row = (HSSFRow) rowIt.next();
HSSFCell code = row.getCell(0);
HSSFCell nom = row.getCell(1);
HSSFCell dt = row.getCell(2);
java.util.Date date = dt.getDateCellValue();
System.out.println("code "+code+" % nom "+nom +" % date " +date);
try {
Class.forName(driver).newInstance();
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
try {
conn = DriverManager.getConnection(url+dbName,username,userPassword);
} catch (SQLException e) {
Statement stmt = null;
try {
stmt = conn.createStatement();
} catch (SQLException e) {
String strQuery = "insert into importxl values ("+code+",'"+nom+"','"+date.getDay()+"/"+date.getMonth()+"/"+date.getYear()+"')";
System.out.println(strQuery);
try {
stmt.close();
} catch (SQLException e) {
try {
conn.close();
} catch (SQLException e) {
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
return null;
and when i run my page and click on the button, this exception page appear :
Error 500--Internal Server Error
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:97)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:94)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:138)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Caused by: javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:698)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:285)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
... 35 more
Caused by: java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
at Mybean.bean1.wrc(bean1.java:23)
at Mybean.MybeanImport.cb1_action(MybeanImport.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... 43 more
Caused by: java.lang.ClassNotFoundException: org.apache.poi.hssf.usermodel.HSSFWorkbook
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:280)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:253)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:37)
... 52 moreHi John,
Ya ur right i too agree we can go for shared Libraries for reusable or massive apps but we still dont know whether OP is gng on the way and also i never said dont go for shared Libraries+
May be he will be running the application locally for any testing purpose..... if it so i have suggested him not to keep the jar files in the folders outside the project....
Why becoz incase the jar file kept in outside folder,
if the folder gets deleted or some times if it kept in any shared folder and user loses the permission error will be thrown it cant be traced why the error gets throwned....
if the jar is gng to be referred from local best way is to keep it in the project folder itself.............
Regards,
Suganth.G -
POI read Excel in Sequence?
hi there,
im new to the forum and have just started working in Java-POI.
below is the code snippet that i used to read out cells from the excel(.xls).
try {
int cellCount = 0;
int emptyRow = 0;
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(fileName));
HSSFSheet sheet = workbook.getSheetAt(0);
Iterator rows = sheet.rowIterator();
int emailIndex = getEmailIndex(fileName);
System.out.println("emailIndex === " + emailIndex);
int r = 1;
if (emailIndex != -1) {
while (rows.hasNext()) {
System.out.println("Row # " + r);
HSSFRow row = (HSSFRow) rows.next();
Iterator cells = row.cellIterator();
myRow = new ArrayList();
cellCount = 0;
boolean isValid = false;
while (cells.hasNext()) {
HSSFCell cell = (HSSFCell) cells.next();
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC:
myRow.add(String.valueOf(cell.getNumericCellValue()).trim());
System.out.println("numeric: " + String.valueOf(cell.getNumericCellValue()).trim());
break;
case HSSFCell.CELL_TYPE_STRING:
if (emailIndex == cellCount) { // email
isValid = isValidEmail(cell.getStringCellValue().trim());
myRow.add(cell.getStringCellValue().trim());
System.out.println("string: " + cell.getStringCellValue().trim());
break;
case HSSFCell.CELL_TYPE_BLANK:
myRow.add(" ");
System.out.println("add empty:");
break;
cellCount++;
} else {
System.err.println("No EMAIL Header found!");
} catch(Exception e){
System.err.println("Caught Exception in getFileList:" + e.getMessage());
}so basically what im doing is to read each row, each cells into an arraylist. however the reading is not in the sequence as how it appeared in the spreadsheet. why is this so? how can i read out exactly the way it is?
im using poi-2.5.1-final-20040804.jar.
pls help me in this.
many thanks!!hi thanks for replying.
for example, my input spreadsheet contains the following cell values in the this sequence :
row 1: EMAIL SALUTATION FIRST_NAME LAST_NAME
row 2: [email protected] Ms. Lucy Tan
row 3: [email protected] Mr. Roy Low
after i run the codes and do a println, i will see the following output:
row 1: FIRST_NAME SALUTATION LAST_NAME EMAIL
row 2: Lucy Ms. Tan [email protected]
row 3: Roy Mr. Low [email protected]
the sequence is not appearing in the way it should be. why? how does POI reads?
thanks. -
Hello everyone, Need help using POI to access xslx data
Hi,
i am trying to make a simple program in OATS which will fetch data and display the output from a xlsx file.
The file name is DriverAdapter and its java script is as below. I have written a java class called ActionDriver whch performs the actions for me using the POI api. But when i instantiate ActionDriver,
it is throwing the exception referrring to POI api classes cannot be found. ClassNotFoundException : org.apache.poi.openxml4j.exceptions.InvalidOperationException;
Can someone help me out to find how can i run this through DriverAdapter. When i tried to run ActionDriver from the same project as a java application by replacing my method with main, it is running fine.
import oracle.oats.scripting.modules.basic.api.*;
import oracle.oats.scripting.modules.browser.api.*;
import oracle.oats.scripting.modules.functionalTest.api.*;
import oracle.oats.scripting.modules.utilities.api.*;
import oracle.oats.scripting.modules.utilities.api.sql.*;
import oracle.oats.scripting.modules.utilities.api.xml.*;
import oracle.oats.scripting.modules.utilities.api.file.*;
import oracle.oats.scripting.modules.webdom.api.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import ats.test.ActionDriver;
public class script extends IteratingVUserScript {
@ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities;
@ScriptService oracle.oats.scripting.modules.browser.api.BrowserService browser;
@ScriptService oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft;
@ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web;
@ScriptService oracle.oats.scripting.modules.formsFT.api.FormsService forms;
private static String myData="C:/data.xlsx";
public void initialize() throws Exception {
//initializing ActionDriver
dAction = new ActionDriver();
* Add code to be executed each iteration for this virtual user.
public void run() throws Exception{
dAction.startAction(myData);
public void finish() throws Exception {
Below is the code for my ActionDriver
package ats.test;
//package sni.test.ats;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
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 ActionDriver
public static void main (String ar[])
//public void startAction(String myData)
boolean b = true;
try
XSSFWorkbook wb = new XSSFWorkbook("c:/data.xlsx");
//XSSFWorkbook wb = new XSSFWorkbook(myData);
XSSFSheet sheet = wb.getSheet(DataConstants.businessFlow);
ArrayList businessRule = new ArrayList();
Iterator rows = sheet.rowIterator();
String myScripts[];
while (rows.hasNext())
XSSFRow row = (XSSFRow) rows.next();
row = (XSSFRow) rows.next();
Iterator cells = row.cellIterator();
while (cells.hasNext())
XSSFCell cell = (XSSFCell) cells.next();
if (cell.getCellType()==XSSFCell.CELL_TYPE_NUMERIC )
businessRule.add(cell.getNumericCellValue());
else
businessRule.add(cell.getStringCellValue());
performAction(businessRule);
catch(Exception fife)
System.out.println("Exception Occured"+fife);
b=false;
/*catch(IOException ie)
System.out.println("Error Handling Input File"+ie);
public static void performAction(ArrayList businessRules)
Object[] businessRuleArray = businessRules.toArray();
boolean b=true;
for (int i=1; i<businessRuleArray.length;i++)
if(b)
String rule = businessRuleArray.toString();
System.out.println(rule);
else
break;[this |http://blogs.oracle.com/aamat/2009/06/load_testing_your_oracle_datab_1.html] Hi
Is that class located in the same folder as the script.java class?
If note you will need to add it on the manifest, you can look at this blogs for instructions on how to edit the manifest file.
Regards
Alex -
Error While trying to Convert a Date Value to string in POI API (Excel)
Hi
How can I convet a date value in excel to string value ? I am using POI API for excel sheet reading in JSP .Hello Esther,
the problem seems to be that the temp folder of the target Integration Builder system can't be found:
'The system cannot find the path specified
at [..] FileAccess.getTempDirectory([..])'.
You'll experience the same problem if you try a file based import or export within the Integration Builder directly.
I would recommend to continue the search there. You could check if the environment variables (for Windows: TEMP and TMP) of the OS of the system with the target Integration Builder to an existing path. Check also if the WebAs can access this path.
Good luck
Frank -
Não tenho problema com uma restrição para simples, mais gostaria de saber de uma solução no aboutconfig, pois conheço todos os sites que uso e 95% deles uso Flash ou outros programas como o java, a restrição está tornando o mozila um navegador irritante, com excesso de segurança torna o navegador limitado, não apoio a mudança drástica pois HTML 5 ainda é uma minima parte do que temos em conteúdo na net, e essa mudança vai transformar o ex melhor navegador em um programa ultrapassado por ser limitado ao impor barreiras de utilização de conteúdo se impõe barreiras na utilização a funcionalidade do produto, gostei muito de utilizar o firefox nos últimos anos mais com o bloqueio do flash não tive a menor duvida em remove-lo do meu pc pois se trata de uma ferramenta ultrapassada para min o concorrente opera ja operava em condições similares e não tem limitação estupidas como essas. caso não haja uma solução facil para a utilização permanente dos plugins em questão declaro o fim da era firefox.
Oi,
As pessoas que respondem as perguntas aqui, na sua maior parte, são outros usuários do Firefox voluntariado seu tempo (como eu), não são funcionários da mozilla ou desenvolvedores do Firefox.
Se quiser deixar a sua opinião para os desenvolvedores do Firefox, clique no menu ''Ajuda'' e depois em ''Enviar minha opinião'' ou através [https://input.mozilla.org/feedback desse link]. Sua opinião é enviada para http://input.mozilla.org/, onde um time de pessoas a leem e coletam dados sobre os problemas mais comuns. -
Na teoria, vemos muita conversa mole sobre mundo, melhor, etc. mas, na prática, esse suporte é muito chato, pois o mesmo é burocrático, sendo necessário um cansável passo a passo para poder interagir de alguma forma.
Tenho sugestão para o navegador firefox:
As letras da barra de endereço são extremamente pequenas, uma falha gravíssima, em um mundo onde os monitores estão cada vez maiores e com maior resolução, e as pessoas sentam longe dos mesmos.
Eu por exemplo, uso o PC plugado à tv de 40" via hdmi, por isso preciso sentar longe, e as letras da barra de endereço são pequenas demais, sendo assim, uso o Google Chrome. O zoom (ctrl+) é muito importante e está presente no firefox e no chrome, mas as letras da barra de endereço não possuem zoom.
Não estou pedindo para colocar a opção zoom na barra de endereço, estou pedindo para aumentarem as letras da barra de endereço, deixando-as do tamanho das letras da barra de endereço do google chrome, talvez até maior.Oi,
As pessoas que respondem as perguntas aqui, na sua maior parte, são outros usuários do Firefox voluntariado seu tempo (como eu), não são funcionários da mozilla ou desenvolvedores do Firefox.
Se quiser deixar a sua opinião para os desenvolvedores do Firefox, clique no menu ''Ajuda'' e depois em ''Enviar minha opinião'' ou através [https://input.mozilla.org/feedback desse link]. Sua opinião é enviada para http://input.mozilla.org/, onde um time de pessoas a leem e coletam dados sobre os problemas mais comuns. -
Error reading excel file using POI.
Hi ,
I am having some problem when reading the excel file.
While reading excel file I am getting error-java.io.IOException: Unable to read entire block; 4 bytes read; expected 512 bytes.
part of my code:-
InputStream stream = objFormFile.getInputStream();
POIFSFileSystem fs = new POIFSFileSystem(stream);//getting above error here.
HSSFWorkbook wb = new HSSFWorkbook(fs);
Case 1:
I download the file on the system ,save it ,and then directly upload it to the system ,I get the above error .
Case 2:
It works fine if I download the excel and manually open and save it and then upload it .
I am using JDK1.4.1 and poi-2.5.1-final-20040804.jar.
Can any one please help me out for the above problem?
Edited by: hruday on Jul 31, 2008 3:20 AMInstead of using POIFSFileSystem, try to directly create the HSSFWorkbook
InputStream stream = objFormFile.getInputStream();
//POIFSFileSystem fs = new POIFSFileSystem( stream );//getting above error here.
HSSFWorkbook wb = new HSSFWorkbook( stream ); -
Help needed to loadjava apache poi jars into oracle database.
Help needed to loadjava apache poi jars into oracle database. Many classes left unresolved. (Poi 3.7, database 11.1.0.7). Please share your experience!
Hi,
The first 3 steps are just perfect.
But with
loadjava.bat -user=user/pw@connstr -force -resolve geronimo-stax-api_1.0_spec-1.0.jar
the results are rather unexpected. Here is a part of the log file:
arguments: '-user' 'ccc/***@bisera7-db.dev.srv' '-fileout' 'c:\temp\load4.log' '-force' '-resolve' '-jarsasdbobjects' '-v' 'geronimo-stax-api_1.0_spec-1.0.jar'
The following operations failed
resource META-INF/MANIFEST.MF: creation (createFailed)
class javax/xml/stream/EventFilter: resolution
class javax/xml/stream/events/Attribute: resolution
class javax/xml/stream/events/Characters: resolution
class javax/xml/stream/events/Comment: resolution
class javax/xml/stream/events/DTD: resolution
class javax/xml/stream/events/EndDocument: resolution
class javax/xml/stream/events/EndElement: resolution
class javax/xml/stream/events/EntityDeclaration: resolution
class javax/xml/stream/events/EntityReference: resolution
class javax/xml/stream/events/Namespace: resolution
class javax/xml/stream/events/NotationDeclaration: resolution
class javax/xml/stream/events/ProcessingInstruction: resolution
class javax/xml/stream/events/StartDocument: resolution
class javax/xml/stream/events/StartElement: resolution
class javax/xml/stream/events/XMLEvent: resolution
class javax/xml/stream/StreamFilter: resolution
class javax/xml/stream/util/EventReaderDelegate: resolution
class javax/xml/stream/util/StreamReaderDelegate: resolution
class javax/xml/stream/util/XMLEventAllocator: resolution
class javax/xml/stream/util/XMLEventConsumer: resolution
class javax/xml/stream/XMLEventFactory: resolution
class javax/xml/stream/XMLEventReader: resolution
class javax/xml/stream/XMLEventWriter: resolution
class javax/xml/stream/XMLInputFactory: resolution
class javax/xml/stream/XMLOutputFactory: resolution
class javax/xml/stream/XMLStreamReader: resolution
resource META-INF/LICENSE.txt: creation (createFailed)
resource META-INF/NOTICE.txt: creation (createFailed)
It seems to me that the root of the problem is the error:
ORA-29521: referenced name javax/xml/namespace/QName could not be found
This class exists in the SYS schema though and is valid. If SYS should be included as a resolver? How to solve this problem? -
Prevent AP Invoices being picked by POII (Payables Open Interface Import)
Hi,
We have a requirement to prevent the AP Invoices in Payable Open Interface table from being picked by POII (Payables Open Interface Import) program.
Kindly provide your inputs on this.
Thanks & Regard,
Satvik PatelThat is correct, the documentation does specify not to populate a value into this field, however there is no harm in doing so.
Alternatively, if you are not using the Payables Open Interface Workflow, then you could either populate a value of "Y" or "S" into the WORKFLOW_FLAG column, to prevent the invoices from getting imported.
Or you could just supply a dummy value for the org_id column in the interface table
Edited by: pillair on Aug 1, 2012 1:10 AM -
PO based Inv thru Payables Open Interface(POI)
Gurus,
I'm in an integration project where in I'm exporting Invoice from third party appln to Oracle 11.5.10.2. My issue is, I sent a PO based Invoice with tax code attached at the Item line without A/c info(bcaz it defaults from PO), the POI successfully processed the invoice. When I see the Invoice in the InvWorkBench, I'm not able to see the Tax Code in the Item line.
To troubleshoot this issue, I pushed a similar PO based Inv with a/c info(dist_code_concatenated), this time after the POI completed, I can see the Tax Code for the item line in the Inv Workbench!
I dont understand this behavior. Bcaz for any PO based Inv, its not recommended to send a/c info. Should I look/populate any additional values to the POI tables to make it work?
Plz advise,
SenAny inputs are highly appreciated.
thanks
sen
Maybe you are looking for
-
Auto update of time/date in a table cell in pages
I used to be able to do this in older versions. In pages when I have a table cell with time/date I would like to have the current date show up every time I open the document. Not on every date in the document, but just in a set cell in a table.
-
OM:Cost of Goods sold work flow customization to take it from concerned off
OM:Cost of Goods sold work flow customization to take it from concerned office in the place of inventory org
-
Outlook 2010 authentication pop up box won't go away
After we applied the latest round of Windows Updates to our guinea pig workstations, we discovered that one of them caused something to break in Outlook 2010. We are set to use AD auto detect authentication on a local Exchange 2007 server. The pop u
-
How to add Web Symphony in HFM
Hello, May I please know how I can add links in my HFM, especially adding web symphony? Thanks.
-
What is the point of an iTunes server?
I have an iTunes server running on a NAS drive (Synology), but since I cannot connect my iPad or Apple TV to it I am wondering what on earth is the point in it? I understand that I can connect my PC to the iTunes server, but as I have no need to I've