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