عدد خلايا ورقة العمل
Contents
[
Hide
]
عدد الخلايا في ورقة العمل
يمكنك عدد الخلايا في ورقة العمل عن طريق استدعاء الـ Cells.getCount() أو الـ Cells.getCountLarge() getters كما هو موضح في مثال الكود المعطى أدناه.
كود عينة
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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()); |