cancel
Showing results for 
Search instead for 
Did you mean: 

JXL WritableWorkbook issues - EmptyStackException thrown on write() method

paskal_singh
Explorer
0 Kudos

Hi Experts,

I have a web dynpro java application that reads in an excel 97 format template and is attempting to write some cells before allowing the user to download it. However, a EmptyStackException is thrown when the write() method is invoked on the Workbook object. Here is a code excerpt:

[code]

IWDWebResource webResource = WDWebResource.getWebResource(wdComponentAPI.getDeployableObjectPart(), WDWebResourceType.XLS,

"test.xls"

);

try

{

      Workbook excelTemplateFromMimes = Workbook.getWorkbook(webResource.read(false);

      ByteArrayOutputStream baos = new ByteArrayOutputStream();

      WritableWorkbook workbook = Workbook.createWorkbook(baos, excelTemplateFromMimes);

      WritableSheet sheet = workbook.getSheet(0);

     

      // do some cell inserts of data

      workbook.write();   //This is the line causing the EmptyStackException

      workbook.close();

}

catch(Exception e)

{

}

[/code]

Any ideas why this might be happening?? I created an empty template "Book1.xls" and it works no issues with that. My "test.xls" file is an extensive excel file with rules, formulas and macros...would this cause an issue? Is Web Dynrpo Java limited to simple excel files?? I'm on Portal 7.0 sps 25, same with NWDS version.

Any suggestions are very welcome.

PS

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

i would suggest you go with apache poi.

paskal_singh
Explorer
0 Kudos

Hi Jun,

Is Apache POI compatible with Java 1.4.2 and Web Dynpro Java for NetWeaver 7.0 SP25?

Answers (2)

Answers (2)

paskal_singh
Explorer
0 Kudos

Hi All,

Thanks for replying.

I'm going to download Apache POI v3.2 (current release is v3.8). I believe this might be the version compatible with the current Java stack we are on (1.4.2). Please let me know otherwise.

PS

junwu
Active Contributor
0 Kudos

POI 3.5 and later requires the JDK version 1.5 or later. Versions prior to 3.5 require JDK 1.4+

3.2 should be good

Stefan-EA
Contributor
0 Kudos

My "test.xls" file is an extensive excel file with rules, formulas and macros...would this cause an issue?

From my experience, JXL does not work well with complicated Excel files.

Is Web Dynrpo Java limited to simple excel files??


No, you can use other 3rd party libraries.

paskal_singh
Explorer
0 Kudos

Hi Stefan,

Which 3rd party library do you recommend for more complex excel files? And will it be compatible with Java 1.4.2, Web Dynrpo Java and Netweaver 7.0 sp25?

Stefan-EA
Contributor
0 Kudos

Paskal Singh wrote:

Hi Stefan,

Which 3rd party library do you recommend for more complex excel files? And will it be compatible with Java 1.4.2, Web Dynrpo Java and Netweaver 7.0 sp25?

JXL is the only 3rd party library I have experience with, however from what my colleagues have said, Apache POI works well. You can download an older version of Apache POI that is compatible with Java 1.4.