Free Support Forum - aspose.com

Questions about ASPOSE CELLS for Java

I am making a concept prove between ASPOSE CELLS for Java vs GemBox.Spreadsheet for Java to see which best suit my company but appers some doubts:

  • Your API use Apache POI? If so, what guarantees do I have that the API will work if one day the POI is discontinued.

  • Optimized recording example

  • It is possible to create a example and return an array of bytes to the customer (no need to IO on HD), if so, I would like examples.

Thankful.

@harleydiniz,

Thanks for contacting support.

For your queries:

  1. No. Aspose.Cells for Java is a component written in pure JAVA that does not use or depend on MS Office or any relevant/other APIs, it is an independent component. The API is not based on Apache POI or MS Open XML sdks, etc. Please see the System Requirements page for your reference.

  2. We recommend you to kindly download and try our featured examples here.

  3. Aspose.Cells does support to save Excel workbooks/files to a Stream via save method of Workbook object. See the following sample code for your reference:
    e.g
    Sample code:

    Workbook wb = new Workbook(is);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    wb.save(out, SaveFormat.XLSX);
    byte[] convertedData = out.toByteArray();

Moreover, see the Aspose.Cells for Java Docs for your complete reference:
https://docs.aspose.com/display/cellsjava/Home

Hope, this helps a bit.

I need to validate the performance of the API.
I did not find information on the site.
For example, the API can write how many million lines in 10 seconds?

Regards

@harleydiniz,

I am afraid, there is no such performance comparison document/article in the Aspose.Cells for Java documentation, we had one or two articles on it sometimes ago but we lately removed it as we think it can be biased practice, kind of advertisement.

We always try to care about what we offer in sets of features should be efficient, accurate, stable and performance oriented. So, we always recommend users to try the APIs and evaluate their scenarios/ cases by themselves. Also, we encourage our users and if you find any issue, let us know with details, we will check and try to fix it soon.

Well, it depends upon the data, its structures and other aspects. Also, it depends upon how many columns will be occupied with specified rows in the matrix. Moreover, we also provide light weight model named LightCells for the purpose, e.g The LightCells API is useful for creating huge Excel spreadsheets quickly and efficiency. See the document for your reference:
https://docs.aspose.com/display/cellsjava/Using+LightCells+API

Hello.

Is the code below optimized to read the spreadsheet in rows and columns?
Is there anything more efficient?
The writing was very good, but in reading this is terrible

		LoadOptions loadOptions = new LoadOptions(FileFormatType.XLSX);
	Instant inicio = Instant.now();
	Workbook workbook = new Workbook("C:\\Users\\harley.freitas\\eclipse-workspace\\poc-api-excel\\poc\\aspose-100000-linhas.xlsx", loadOptions);
	Worksheet sheet = workbook.getWorksheets().get("Sheet 100000 linhas");
	Cells cells = sheet.getCells();
	for (int i = 0; i < cells.getMaxDataRow(); i++) {
		for (int j = 0; j < cells.getMaxDataColumn(); j++) {
			cells.get(i, j).getValue();
		}
	}
	
	Instant fim = Instant.now();
	
	System.out.println("Executado em: " + (Duration.between(inicio, fim).toMillis() / 1000.0) + " segundos.");

Thankful

@harleydiniz,
It seems to be ok however you may also try reading this file using LightCells API as described in the following article.

Using Light Cells API

@harleydiniz,

Well, LightCells API will surely give better performance if you just need to iterate all cell values in the worksheet. However, if you need to work with the workbook in “normal” mode, using Cells.MinColumn/MinDataColumn/MaxColumn/MaxDataColumn in loops, it is always bad practice and it will give poor performance for sure.

Firstly, those values are not static data but are calculated dynamically and the process is time-costed. If you need to use those values, they should assign the value to variable and use the variable later in the loop.

Secondly, if you need to iterate cells, the best way is to use the Iterator which can be got from Cells/Row/Range objects. This way will give you best performance.
e.g
Sample code:

Workbook book = new Workbook("Book1.xlsx");
Worksheet sheet = book.getWorksheets().get(0);
Range range = sheet.getCells().getMaxDisplayRange();//You may also create your desired range (in the worksheet) using, e.g sheet.getCells().createRange("A1", "J11");
Iterator rangeIterator = range.iterator();
while(rangeIterator.hasNext())
{
Cell cell = (Cell)rangeIterator.next();
System.out.println(cell.getValue() );
}
........

Hope, this helps a bit.