Trova il numero massimo di righe e colonne supportate dai formati XLS e XLSX

Possibili Scenari di Utilizzo

I formati Excel supportano un numero diverso di righe e colonne. Ad esempio, XLS supporta 65536 righe e 256 colonne, mentre XLSX supporta 1048576 righe e 16384 colonne. Se si desidera sapere quante righe e colonne sono supportate dal formato dato, è possibile utilizzare le proprietà Workbook.Settings.MaxRow e Workbook.Settings.MaxColumn.

Trova il numero massimo di righe e colonne supportate dai formati XLS e XLSX

Il codice di esempio seguente crea prima un workbook in formato XLS e poi in formato XLSX. Dopo la creazione, stampa i valori delle proprietà Workbook.Settings.MaxRow e Workbook.Settings.MaxColumn. Si prega di consultare l’output della console del codice riportato di seguito per il riferimento.

Codice di Esempio

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Print message about XLS format.
System.out.println("Maximum Rows and Columns supported by XLS format.");
// Create workbook in XLS format.
Workbook wb = new Workbook(FileFormatType.EXCEL_97_TO_2003);
// Print the maximum rows and columns supported by XLS format.
int maxRows = wb.getSettings().getMaxRow() + 1;
int maxCols = wb.getSettings().getMaxColumn() + 1;
System.out.println("Maximum Rows: " + maxRows);
System.out.println("Maximum Columns: " + maxCols);
System.out.println();
// Print message about XLSX format.
System.out.println("Maximum Rows and Columns supported by XLSX format.");
// Create workbook in XLSX format.
wb = new Workbook(FileFormatType.XLSX);
// Print the maximum rows and columns supported by XLSX format.
maxRows = wb.getSettings().getMaxRow() + 1;
maxCols = wb.getSettings().getMaxColumn() + 1;
System.out.println("Maximum Rows: " + maxRows);
System.out.println("Maximum Columns: " + maxCols);

Output della console

 Maximum Rows and Columns supported by XLS format.

Maximum Rows: 65536

Maximum Columns: 256

Maximum Rows and Columns supported by XLSX format.

Maximum Rows: 1048576

Maximum Columns: 16384