cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Upload Not Working

Former Member
0 Kudos

Dear Friends,

In our one of the application we have implemented the Excel upload functionality. After browsing the excel file , on click of button event we are displaying the content in a table. Now the strange issue is on our sandbox server it is working but on Q , D and P , it is not working. We have some SP level difference between Sandbox and other system . What could be the problem and solution ?

Sandbox : 7.31 SP Level 12

Quality : 7.31 SP level 17

Regards,

Mayank

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

nothing do to with sap.

excel handling is all on you.

not working is too vague. please detail

can't u debug?

Former Member
0 Kudos

Hello Mr. Wu,

Thank you for your reply. I debugged the code and problem is same code is working with system having lower SP level (12).

If you check the below mentioned code , the highlighted line

Sheet sh = wb.getSheet(0) is not being executed with SP 17 version. but same line is working in SP 12.  After the execution of this line control is jumping to Catch statement.

if (path != null) {

// Collection clearer = null;

  wdContext.nodeSyngoExcelUpload().invalidate(); //bind(clearer);

  Workbook wb;

  try {

  wb = Workbook.getWorkbook(new File(path));

Sheet sh = wb.getSheet(0);

  int columns = sh.getColumns();

  int rows = sh.getRows();

  int i = 0;

  for (int j = 1; j < rows; j++) {

  xlsElem = wdContext.nodeSyngoExcelUpload()

  .createAndAddSyngoExcelUploadElement();

  Cell c1 = sh.getCell(i, j);

  xlsElem.setSernr(c1.getContents());

....

....

....

...

...

Any help ?

junwu
Active Contributor
0 Kudos

code is badly written.....

Workbook.getWorkbook(new File(path));

i think you can construct with stream. no need file.

Former Member
0 Kudos

Hello Jun,

I tried with below mentioned code as well and still getting the same problem.

Is this correct ?

try {

  FileInputStream fs = new FileInputStream(path);

  wb = Workbook.getWorkbook(fs);

  Sheet sh = wb.getSheet(0);

junwu
Active Contributor
0 Kudos

you are still using file.....

when the file uploaded, you can get the stream directly and then construct workbook

Former Member
0 Kudos

Hi Jun,

We have modified our code to :

Workbook wb;

try {

wb = Workbook.getWorkbook(wdContext.currentContextElement().getRessource().read(false));

Sheet sh = wb.getSheet(0);

int columns = sh.getColumns();

int rows = sh.getRows();

int i = 0;

for (int j = 1; j < rows; j++) {

xlsElem = wdContext.nodeSyngoExcelUpload().createAndAddSyngoExcelUploadElement();

Cell c1 = sh.getCell(i, j);

xlsElem.setSernr(c1.getContents());

cell c2 = sh.getCell(i + 1, j);

xlsElem.setMatnr(c2.getContents());

Cell c3 = sh.getCell(i + 2, j);

xlsElem.setEqunr(c3.getContents());

.....

.....

Still is it wrong ?

It is working on sandbox but not on upgraded SP17 systems. Do you think that there is some security issue on systems.

Regards,

MS

junwu
Active Contributor
0 Kudos

what's the error?

Former Member
0 Kudos

Hi Jun,

Thanks for your quick reply. On one system it is working and on other it is giving :

“Unable to recognize OLE stream


We have already changed the jxl jar.


Regards,

Mayank Saxena

junwu
Active Contributor
0 Kudos

do you know how to use third party lib correctly? make sure jxl jar is updated correctly

Former Member
0 Kudos

Hi,

We have created the external dc for this lib and it is working on local sandbox. And it was working before the upgrade.

Regards,

Mayank