We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to read data inside cells using Aspose.cells for Java

Hi,


I am unable to retrieve the data of the individual cell for Excel 2007 using Aspose cell. However the same piece of code is working fine for Excel 97-2003 when i am using FileFormatType.Excel2003.

////

mInputStream = uploadedFile.getInputStream();
List mXYZs = new ArrayList();
Workbook mWorkbook = new Workbook();
mWorkbook.open(mInputStream, FileFormatType.EXCEL2007);
Worksheets mWorksheets = mWorkbook.getWorksheets();
Worksheet mWorksheet = mWorksheets.getSheet(0);
Cells mCells = mWorksheet.getCells();
int maxRow=mCells.getMaxRow();
Iterator mCellIterator = mCells.getCellIterator();
while (mCellIterator.hasNext()) {
Cell mCell=(Cell) mCellIterator.next();
mXYZs .add(mCell.getIntValue());
}

//*//

The maxRow shows the number originally entered for Excel 2003(e.g. 10) however the maxRow is returning -1 in case of Excel 2007. Kindly advice as soon as possible.

Hi,


It looks you are using older version of the product. Please upgrade and use latest version / fix of the product: Aspose.Cells for Java v7.0.3.2 Also, please use: … new LoadOptions(LoadFormat.XLSX) instead of FileFormatType.XLSX when loading template file with new version, e.g

Workbook mWorkbook = new Workbook(mInputStream, new LoadOptions(LoadFormat.XLSX));



If you still find the issue using with latest version, kindly give us your template file we will check it soon.

Thank you.

Hey thanks for the suggestion. I tried with the version of the jar that you mentioned. Now i am encountering a strange problem and the below exception is shown in the console. Kindly advise.


<Nov 29, 2011 4:31:49 PM IST> <[weblogic.servlet.internal.WebAp
, name: ‘/tools’, context-path: ‘/tools’] Servlet failed with Exception
java.lang.NoClassDefFoundError: com/ctc/wstx/stax/WstxInputFactory
at com.aspose.cells.b.a.h.j.a(Unknown Source)
at com.aspose.cells.b.a.h.j.a(Unknown Source)
at com.aspose.cells.b.a.h.j.(Unknown Source)
at com.aspose.cells.b.a.h.j.(Unknown Source)
at com.aspose.cells.kZ.a(Unknown Source)
Truncated. see log file for complete stacktrace
>

Hi,


It looks that you are not setting other JARs into your class path. Please make sure that you set all other JARs into your class path to work with the product.

Please find the required libraries downloading the release archive@: Aspose.Cells for Java 7.0.3

Jar File names, i.e.
  1. aspose-cells-7.0.3.2.jar
  2. bcprov-jdk16-146.jar
  3. dom4j-1.6.1.jar
  4. stax2-api-3.0.2.jar
  5. woodstox-core-asl-4.1.1.jar
  6. etc.

Thank you.