cancel
Showing results for 
Search instead for 
Did you mean: 

Read Excel file path in WD

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Try this:

InputStream in = wdContext.currentContextElement().getFileResource().read(false);

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

I can't find .read() method.

Anyother way.

Regards,

Vaibhav

Former Member
0 Kudos

chk it