cancel
Showing results for 
Search instead for 
Did you mean: 

Reading an Excel document from KM

former_member188556
Active Contributor
0 Kudos

Hi,

I am trying to read an Excel doc from KM.

I am using following code to get the inputStream of the excel file....

<i><b>IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

IUser sapUser = wdClientUser.getSAPUser();

com.sapportals.portal.security.usermanagement.IUser ep5User =

WPUMFactory.getUserFactory().getEP5User(sapUser);

IResourceContext resourseContext = new ResourceContext(ep5User);

IResourceFactory resourseFactory = ResourceFactory.getInstance();

RID pathRID = RID.getRID("/documents/George/SystemFile.xls");

IResource resource =

(IResource) resourseFactory.getResource(

pathRID,

resourseContext);

InputStream in = resource.getContent().getInputStream();</b></i>

Then i try using this code to open excel

<i>

<b>workbook = Workbook.getWorkbook(in);</b></i>

This is where i get my error!!!!

<b>java.lang.NoClassDefFoundError: jxl/read/biff/BiffException</b>

I have got the fileInputStream printed out and its giving me a value.

But when i try <i>

<b>workbook = Workbook.getWorkbook(in);</b></i>, i get exception.

I have included excel.jar for this.

Any ideas, welcome

Thanks in Advance

BP

Accepted Solutions (1)

Accepted Solutions (1)

former_member182374
Active Contributor
0 Kudos

Hi,

Put the excel.jar file under the lib directory in your WD project, deploy and run application.

Omri

former_member188556
Active Contributor
0 Kudos

Thanks Omri,

Well, i still have a doubt.

why didnt it work even though i have added the excel.jar in the<b> "Add external jar"</b> option in the property of the wd project?

regards

BP

former_member182374
Active Contributor
0 Kudos

Hi,

When you add a jar to the classpath it's for BUILD time.

When you add it to the lib it's for RUNTIME.

Regards,

Omri

Answers (1)

Answers (1)

former_member185029
Active Contributor
0 Kudos

Hello BP,

Are you using a DTR for creating/deploying your application?

In that case, you will need to create a library project and expose excel.jar file as a public part. If you are not using DTR, you will need to copy excel.jar file in lib folder of the project.

Regards,

Ashutosh