Contar el número de celdas en la hoja de cálculo

Contar el número de celdas en la hoja de cálculo

Puede contar el número de celdas en la hoja de cálculo llamando a los métodos getter de propiedad Cells.getCount() o Cells.getCountLarge() como se muestra en el ejemplo de código dado a continuación.

Código de Muestra

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(CountNumberOfCells.class) + "Worksheets/";
//Load source Excel file
Workbook workbook = new Workbook(dataDir + "BookWithSomeData.xlsx");
//Access first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
//Print number of cells in the Worksheet
System.out.println("Number of Cells: " + worksheet.getCells().getCount());
// If the number of cells is greater than 2147483647, use CountLarge
System.out.println("Number of Cells (CountLarge): " + worksheet.getCells().getCountLarge());