XLSおよびXLSX形式がサポートする最大行数および列数を検索する
Contents
[
Hide
]
可能な使用シナリオ
Excel形式でサポートされる行数と列数は異なります。たとえば、XLSは65536行と256列をサポートし、XLSXは1048576行と16384列をサポートします。与えられた形式でサポートされる行数と列数を知りたい場合は、Workbook.Settings.MaxRowおよびWorkbook.Settings.MaxColumnプロパティを使用できます。
XLSおよびXLSX形式がサポートする最大行数および列数を検索する
次のサンプルコードでは、最初にXLSおよび次にXLSX形式でワークブックを作成します。作成後、Workbook.Settings.MaxRowおよびWorkbook.Settings.MaxColumnプロパティの値を出力します。次のコードのコンソール出力を参照してください。
サンプルコード
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 | |
// 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); |
コンソール出力
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