1

While trying to read an xls file using jExcelAPI, I find that the library dumps a lot of information in stderr, sometimes this information is not relevant. For example, this code snippet causes lots of 'Warnings' to be dumped on stderr stream:

    Workbook workbook = Workbook.getWorkbook(new File(flname));


    //For each sheet in the workbook
    for (int currentSheet = 0; currentSheet < workbook.getNumberOfSheets(); currentSheet++)
    {
        Sheet sheet = workbook.getSheet(currentSheet);
        System.out.println("Currently processing " + sheet.getName());
    }

The warnings are like:

Currently processing frst sheet
Warning:  Cell C33680 already contains data
Warning:  Cell D33680 already contains data
Warning:  Cell E33680 already contains data
Warning:  Cell F33680 already contains data
Warning:  Cell B33680 already contains data
Currently processing Lst Sheet

How to avoid the library from dumping all this unwanted data? Also I do not understand why the code even looks at all the cells of the sheet, when all I am asking for it to do is list the name of the sheets (I understand that Workbook.getSheetNames() can do a similar task - but say I wanted to print the name of the sheet and contents of a single cell in the sheet).

Am I using the library incorrectly?

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
Rishabh Sagar
  • 1,744
  • 2
  • 17
  • 27

1 Answers1

1

I have never used this library, however quick look at Logger.initializeLogger() it looks like by default it tries to Log using Log4J. Do you have Log4J on your CLASSPATH? You can also use SLF4J bridge.

When you successfully redirect JExcelAPI into logging framework, you can configure which messages are dumped (and where).

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
  • Thanks for pointing out. It seems that by default all the message are directed to standard streams - but if the library is rebuilt with logger options, then we can use it. But still not very sure why does the function even look at all this data! – Rishabh Sagar Oct 23 '11 at 09:16