on 08-30-2007 8:22 AM
Hi,
We want to read a excel file. For that we are using file upload UI element and HSSF POI to read excel file. The code to read the excel file is working fine in standalone. In standalone we are hardcoding the file path. But in WD application, we are not hard coding it.
We are using following code to supply the file name to HSSF code through file upload UI:
try
{
InputStream in = new FileInputStream(wdContext.currentContextElement
().getFileResource());
wdComponentAPI.getMessageManager().reportSuccess("IN "+in);
HSSFWorkbook wb = new HSSFWorkbook(in);
.
.
.
.
.
}
catch (Exception e)
{
wdComponentAPI.getMessageManager().reportSuccess("ERROR in HSSF");
}
Where FileResource is a context variable binded with property "data" of FileUpload UI element.
Now, the problem is that the excel file is not getting read. We are getting ERROR in HSSF message.
Please help in reading the file path.
Regards,
Vaibhav
Hi,
Try this:
InputStream in = wdContext.currentContextElement().getFileResource().read(false);
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.