Alternative API to get Cell[][] in newer Aspose.Cells for Java 7.0.0

Hi,

AsposeCell 2.5.4 has Worksheet.getCells().getCells(startRow,startCol,tRow,tColumn) which returned Cell[][].

What is the new API in Aspose 7.0.0 to get the Cell[][].

Thanks in advance.

Hi,

I am unable to find such a method in the latest version:
Aspose.Cells for Java v7.0.1.3


Please provide us your simple sample code so that we could provide you a workaround or add a request for this method in our database.

Hi,

For this requirement, please use Range.iterator() instead to get and process cell objects in given range.

Yes that is right it is not supported in 7.0.0 but it was in 2.5.4 and earlier version.

Here is the sample code that I have with ASPOSE version 2.5.4

public com.aspose.cells.Cell[][] getRangeOfCells(int startRow, int startCol, int tRow,int tColumn) {

return this.internalWorksheet.getCells().getCells(startRow,startCol,tRow,tColumn);

}

As a workaround if I can get a API which reads the worksheet data and give the range of cells for the specified row(start/end index) and column(start/end index) that would be good too.

Thanks

Hi,

Please see the code below. It creates a range from first cell to last cell. Please see the source.xlsx file.

Once, the range is created, it gets its iterator and then prints all the values of cell using a while loop.

Please see its output.

Java

String path = “F:\Shak-Data-RW\Downloads\Source.xlsx”;

Workbook workbook = new Workbook(path);

Worksheet worksheet = workbook.getWorksheets().get(0);

Cell cell = worksheet.getCells().getLastCell();

String lastCellName = cell.getName();

//System.out.println(lastCellName);

//Create range that will include all cells

//and print the values of all cells

Range rng = worksheet.getCells().createRange(“A1”, lastCellName);

Iterator allCells = rng.iterator();

while(allCells.hasNext())

{

Cell nextCell = allCells.next();

//Print cell value

System.out.println(nextCell.getStringValue());

}


Output:
434
312
564
505
132
885
520
307
749
695
160
507
1000
590
53
626
563
656
363
945
52
115
751
405
820
785
405
896
391
20
953
584
58
867
464
432
962
651
473
646
494
951
660
787
558
886
973
319
756
681
142
25
145
436
411
726
479
52
496
463
257
584
880
439
480
437
545
403
497
334
450
273
797
45
584
998
4
114
74
738
827
280
601
602
586
667
474
260
474
372
874
446
30
459
752
149
674
630
695
263
468
879
591
134
976
315
723
520
407
268
903
385
108
904
22
84
996
147
459
639
220
870
895
329
359
42
517
446
56
217
538
326
899
325
27
700
42
541
203
807
724
737
832
272
178
348
927
641
83
447
589
226
264
81
343
47
55
462
326
661
351
75
747
395
659
919
69
726
444
64
398
619
246
112
85
84
605
302
851
644
904
973
180
770

Thanks for workaround for range of cells.

Another ? Aspose7.0.1 is very slow in copy of a worksheet with 62K rows any suggestion on that one.

Thanks again!

Hi,


Could you try our latest version v7.0.2:
http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry335888.aspx

If you still find the issue, give us your sample code and template file(s) to reproduce the issue on our end.

Thank you.