Finden Sie maximale Zeilen und Spalten, die von den Formaten XLS und XLSX unterstützt werden

Mögliche Nutzungsszenarien

Es gibt eine unterschiedliche Anzahl von Zeilen und Spalten, die von Excel-Formaten unterstützt werden. Beispielsweise unterstützt XLS 65536 Zeilen und 256 Spalten, während XLSX 1048576 Zeilen und 16384 Spalten unterstützt. Wenn Sie wissen möchten, wie viele Zeilen und Spalten von einem bestimmten Format unterstützt werden, können Sie verwendenArbeitsmappe.Einstellungen.MaxRowundArbeitsmappe.Einstellungen.MaxColumnEigenschaften.

Finden Sie maximale Zeilen und Spalten, die von den Formaten XLS und XLSX unterstützt werden

Der folgende Beispielcode erstellt eine Arbeitsmappe zuerst im Format XLS und dann im Format XLSX. Nach der Erstellung werden die Werte von gedrucktArbeitsmappe.Einstellungen.MaxRowundArbeitsmappe.Einstellungen.MaxColumnEigenschaften. Bitte sehen Sie sich die Konsolenausgabe des unten angegebenen Codes als Referenz an.

Beispielcode

// 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);

Konsolenausgabe

 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